Skip to content

Commit

Permalink
Merge pull request #350 from YuriCat/fix/disconnect_after_timeout
Browse files Browse the repository at this point in the history
fix: disconnect after socket.timeout
  • Loading branch information
YuriCat committed Apr 19, 2024
2 parents cce6a40 + 4ac69aa commit 6008b1c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions handyrl/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def _send_thread(self):
conn, send_data = self.output_queue.get()
try:
conn.send(send_data)
except TimeoutError:
self.disconnect(conn)
except ConnectionResetError:
self.disconnect(conn)
except BrokenPipeError:
Expand All @@ -215,6 +217,9 @@ def _recv_thread(self):
for conn in conns:
try:
recv_data = conn.recv()
except TimeoutError:
self.disconnect(conn)
continue
except ConnectionResetError:
self.disconnect(conn)
continue
Expand Down

0 comments on commit 6008b1c

Please sign in to comment.