From ccdfdb5db0a6b2487ef0a100bd5ca696079aa9f7 Mon Sep 17 00:00:00 2001 From: Marks Polakovs Date: Thu, 16 Apr 2020 13:07:25 +0200 Subject: [PATCH] Log reasons for connection ends --- shittyserver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shittyserver.py b/shittyserver.py index 1c4f32e..94b01c3 100644 --- a/shittyserver.py +++ b/shittyserver.py @@ -223,6 +223,7 @@ class Session(object): "ICE connection state is {}".format(self.pc.iceConnectionState), ) if self.pc.iceConnectionState == "failed": + print(self.connection_id, "Ending due to ICE connection failure") await self.end() @self.pc.on("track") # type: ignore @@ -236,7 +237,7 @@ class Session(object): @track.on("ended") # type: ignore async def on_ended() -> None: - print(self.connection_id, "Track {} ended".format(track.kind)) + print(self.connection_id, "Ending due to {} track end".format(track.kind)) await self.end() write_ob_status(True) @@ -244,7 +245,7 @@ class Session(object): try: frame = await track.recv() except MediaStreamError as e: - print(self.connection_id, "MediaStreamError") + print(self.connection_id, "Ending due to MediaStreamError") print(e) await self.end() break @@ -327,7 +328,7 @@ class Session(object): ) except websockets.exceptions.ConnectionClosed: - print(self.connection_id, "WebSocket closed") + print(self.connection_id, "Ending due to dead WebSocket") await self.end()