Update the producer's handle to close the connection if empty data.

This commit is contained in:
2023-12-12 20:30:40 +02:00
parent d000abfaec
commit bfdabd8d62
+7 -1
View File
@@ -76,8 +76,14 @@ class Server:
try:
while True:
title = await self.receive_message(reader)
message = await self.receive_message(reader)
print(f"{message=}")
if title == '' and message == '':
self.console.print(f"The producer ({addr[0]}:{addr[1]}) finished.")
break
await self.broadcast_message(title)
await self.broadcast_message(message)
except asyncio.CancelledError: