summaryrefslogtreecommitdiff
path: root/kvmd/apps/vnc/rfb/stream.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-09-18 04:37:43 +0300
committerMaxim Devaev <[email protected]>2024-09-18 04:37:43 +0300
commit7a53f1445619fc471c2823e7081de8b6039b938e (patch)
tree961dd0072cc976504fe4570743d801c79512e9a6 /kvmd/apps/vnc/rfb/stream.py
parent45270a09d7b5076bac96887a1e36d752882e3adf (diff)
refactoring
Diffstat (limited to 'kvmd/apps/vnc/rfb/stream.py')
-rw-r--r--kvmd/apps/vnc/rfb/stream.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/kvmd/apps/vnc/rfb/stream.py b/kvmd/apps/vnc/rfb/stream.py
index 44998617..dc3ceb1b 100644
--- a/kvmd/apps/vnc/rfb/stream.py
+++ b/kvmd/apps/vnc/rfb/stream.py
@@ -51,22 +51,22 @@ class RfbClientStream:
else:
fmt = f">{fmt}"
return struct.unpack(fmt, await self.__reader.readexactly(struct.calcsize(fmt)))[0]
- except (ConnectionError, asyncio.IncompleteReadError) as err:
- raise RfbConnectionError(f"Can't read {msg}", err)
+ except (ConnectionError, asyncio.IncompleteReadError) as ex:
+ raise RfbConnectionError(f"Can't read {msg}", ex)
async def _read_struct(self, msg: str, fmt: str) -> tuple[int, ...]:
assert len(fmt) > 1
try:
fmt = f">{fmt}"
return struct.unpack(fmt, (await self.__reader.readexactly(struct.calcsize(fmt))))
- except (ConnectionError, asyncio.IncompleteReadError) as err:
- raise RfbConnectionError(f"Can't read {msg}", err)
+ except (ConnectionError, asyncio.IncompleteReadError) as ex:
+ raise RfbConnectionError(f"Can't read {msg}", ex)
async def _read_text(self, msg: str, length: int) -> str:
try:
return (await self.__reader.readexactly(length)).decode("utf-8", errors="ignore")
- except (ConnectionError, asyncio.IncompleteReadError) as err:
- raise RfbConnectionError(f"Can't read {msg}", err)
+ except (ConnectionError, asyncio.IncompleteReadError) as ex:
+ raise RfbConnectionError(f"Can't read {msg}", ex)
# =====
@@ -84,8 +84,8 @@ class RfbClientStream:
self.__writer.write(struct.pack(f">{fmt}", *values))
if drain:
await self.__writer.drain()
- except ConnectionError as err:
- raise RfbConnectionError(f"Can't write {msg}", err)
+ except ConnectionError as ex:
+ raise RfbConnectionError(f"Can't write {msg}", ex)
async def _write_reason(self, msg: str, text: str, drain: bool=True) -> None:
encoded = text.encode("utf-8", errors="ignore")
@@ -94,8 +94,8 @@ class RfbClientStream:
self.__writer.write(encoded)
if drain:
await self.__writer.drain()
- except ConnectionError as err:
- raise RfbConnectionError(f"Can't write {msg}", err)
+ except ConnectionError as ex:
+ raise RfbConnectionError(f"Can't write {msg}", ex)
async def _write_fb_update(self, msg: str, width: int, height: int, encoding: int, drain: bool=True) -> None:
await self._write_struct(
@@ -123,8 +123,8 @@ class RfbClientStream:
server_side=True,
ssl_handshake_timeout=ssl_timeout,
)
- except ConnectionError as err:
- raise RfbConnectionError("Can't start TLS", err)
+ except ConnectionError as ex:
+ raise RfbConnectionError("Can't start TLS", ex)
ssl_reader.set_transport(transport) # type: ignore
ssl_writer = asyncio.StreamWriter(