diff options
author | Devaev Maxim <[email protected]> | 2019-02-06 08:08:22 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-02-06 08:08:22 +0300 |
commit | 5bec2ff1449832be374d69ece14e7a63d5d7379a (patch) | |
tree | 0e9e05b54a178c3cec42b97332e2424622269640 /kvmd/apps | |
parent | e20553bfc63ae124a6f4b14465bea4815a42c8af (diff) |
lint fix
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/kvmd/server.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py index 8ba09568..f3e7ddc8 100644 --- a/kvmd/apps/kvmd/server.py +++ b/kvmd/apps/kvmd/server.py @@ -545,22 +545,22 @@ class Server: # pylint: disable=too-many-instance-attributes }, })) 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) async def __register_socket(self, ws: aiohttp.web.WebSocketResponse) -> None: async with self.__sockets_lock: self.__sockets.add(ws) - get_logger().info("Registered new client socket: remote=%s; id=%d; active=%d", - ws._req.remote, id(ws), len(self.__sockets)) # pylint: disable=protected-access + remote: Optional[str] = (ws._req.remote if ws._req is not None else None) # 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 with self.__sockets_lock: await self.__hid.clear_events() try: self.__sockets.remove(ws) - get_logger().info("Removed client socket: remote=%s; id=%d; active=%d", - ws._req.remote, id(ws), len(self.__sockets)) # pylint: disable=protected-access + remote: Optional[str] = (ws._req.remote if ws._req is not None else None) # 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() except Exception: pass @@ -602,7 +602,7 @@ class Server: # pylint: disable=too-many-instance-attributes async def __poll_dead_sockets(self) -> None: while True: 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 asyncio.sleep(0.1) |