mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-15 10:40:28 +08:00
lint fix
This commit is contained in:
parent
e20553bfc6
commit
5bec2ff144
@ -545,22 +545,22 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
for ws in list(self.__sockets)
|
for ws in list(self.__sockets)
|
||||||
if not ws.closed and ws._req.transport # pylint: disable=protected-access
|
if not ws.closed and ws._req is not None and ws._req.transport is not None # pylint: disable=protected-access
|
||||||
], return_exceptions=True)
|
], return_exceptions=True)
|
||||||
|
|
||||||
async def __register_socket(self, ws: aiohttp.web.WebSocketResponse) -> None:
|
async def __register_socket(self, ws: aiohttp.web.WebSocketResponse) -> None:
|
||||||
async with self.__sockets_lock:
|
async with self.__sockets_lock:
|
||||||
self.__sockets.add(ws)
|
self.__sockets.add(ws)
|
||||||
get_logger().info("Registered new client socket: remote=%s; id=%d; active=%d",
|
remote: Optional[str] = (ws._req.remote if ws._req is not None else None) # pylint: disable=protected-access
|
||||||
ws._req.remote, id(ws), len(self.__sockets)) # pylint: disable=protected-access
|
get_logger().info("Registered new client socket: remote=%s; id=%d; active=%d", remote, id(ws), len(self.__sockets))
|
||||||
|
|
||||||
async def __remove_socket(self, ws: aiohttp.web.WebSocketResponse) -> None:
|
async def __remove_socket(self, ws: aiohttp.web.WebSocketResponse) -> None:
|
||||||
async with self.__sockets_lock:
|
async with self.__sockets_lock:
|
||||||
await self.__hid.clear_events()
|
await self.__hid.clear_events()
|
||||||
try:
|
try:
|
||||||
self.__sockets.remove(ws)
|
self.__sockets.remove(ws)
|
||||||
get_logger().info("Removed client socket: remote=%s; id=%d; active=%d",
|
remote: Optional[str] = (ws._req.remote if ws._req is not None else None) # pylint: disable=protected-access
|
||||||
ws._req.remote, id(ws), len(self.__sockets)) # pylint: disable=protected-access
|
get_logger().info("Removed client socket: remote=%s; id=%d; active=%d", remote, id(ws), len(self.__sockets))
|
||||||
await ws.close()
|
await ws.close()
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
@ -602,7 +602,7 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
async def __poll_dead_sockets(self) -> None:
|
async def __poll_dead_sockets(self) -> None:
|
||||||
while True:
|
while True:
|
||||||
for ws in list(self.__sockets):
|
for ws in list(self.__sockets):
|
||||||
if ws.closed or not ws._req.transport: # pylint: disable=protected-access
|
if ws.closed or ws._req is None or ws._req.transport is None: # pylint: disable=protected-access
|
||||||
await self.__remove_socket(ws)
|
await self.__remove_socket(ws)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user