File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -854,17 +854,24 @@ def loop(self, timeout=1):
854854 )
855855 rcs = self .ping ()
856856 return rcs
857- self ._sock .settimeout (timeout )
858857
859- responses = []
858+ stamp = time .monotonic ()
859+ self ._sock .settimeout (timeout )
860+ rcs = []
860861 while True :
861862 rc = self ._wait_for_msg ()
862863 if rc == None :
863864 break
865+ if time .monotonic () - stamp > self ._recv_timeout :
866+ if self .logger is not None :
867+ self .logger .debug (
868+ f"Loop timed out, message queue not empty after { self ._recv_timeout } s"
869+ )
870+ break
864871 else :
865- responses .append (rc )
872+ rcs .append (rc )
866873
867- return responses if responses else None
874+ return rcs if rcs else None
868875
869876
870877 def _wait_for_msg (self , timeout = 0.1 ):
You can’t perform that action at this time.
0 commit comments