File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -907,7 +907,18 @@ async def initial_connection(self, data):
907
907
struct .pack_into (">H" , packet , 2 , 70 ) # 70 = Length
908
908
struct .pack_into (">I" , packet , 4 , state .ssrc )
909
909
state .socket .sendto (packet , (state .endpoint_ip , state .voice_port ))
910
- recv = await self .loop .sock_recv (state .socket , 74 )
910
+
911
+ try :
912
+ recv = await asyncio .wait_for (self .loop .sock_recv (state .socket , 74 ), timeout = 2.0 )
913
+ except asyncio .TimeoutError as e :
914
+ _log .error (f"Websocket Receive operation timed out. This can happen due to malformed data. { e } " )
915
+ _log .debug (f"Problematic packet: { packet } " )
916
+ raise e
917
+ except OSError as e :
918
+ _log .error (f"Websocket Receive operation encountered an OSError: { e } " )
919
+ _log .debug (f"Problematic packet: { packet } " )
920
+ raise e
921
+
911
922
_log .debug ("received packet in initial_connection: %s" , recv )
912
923
913
924
# the ip is ascii starting at the 8th byte and ending at the first null
You can’t perform that action at this time.
0 commit comments