Skip to content

Commit 9b450d4

Browse files
committed
Fix return values in CMClient's read loop methods
1 parent 2fc0aad commit 9b450d4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/steam/utils/cm_client/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,12 @@ async def disconnect(self):
210210

211211
if self._loop_task:
212212
self._loop_task.cancel()
213+
213214
try:
214215
await self._loop_task
215216
except asyncio.CancelledError:
216217
pass
218+
217219
self._loop_task = None
218220

219221
if self.writer:
@@ -298,7 +300,7 @@ async def listen(self) -> Optional[bytes]:
298300
"""
299301
if not self.reader:
300302
self._log.warning("Not connected")
301-
return
303+
return None
302304

303305
try:
304306
length_data = await self.reader.readexactly(4)
@@ -307,7 +309,7 @@ async def listen(self) -> Optional[bytes]:
307309

308310
if magic_header != MAGIC_HEADER.encode():
309311
self._log.warning("Invalid magic header, disconnecting")
310-
return
312+
return None
311313

312314
message = await self.reader.readexactly(length)
313315

@@ -322,7 +324,7 @@ async def listen(self) -> Optional[bytes]:
322324

323325
except asyncio.IncompleteReadError:
324326
self._log.warning("Server closed connection")
325-
return
327+
return None
326328
except Exception as e:
327329
self._log.error(f"Error listening: {e}")
328-
return
330+
return None

0 commit comments

Comments
 (0)