Browse Source

fixes

pull/1407/head
Miguel Grinberg 4 months ago
parent
commit
9fad09f28f
Failed to extract signature
  1. 5
      src/socketio/async_client.py
  2. 7
      src/socketio/client.py

5
src/socketio/async_client.py

@ -188,9 +188,10 @@ class AsyncClient(base_client.BaseClient):
while True:
await self.eio.wait()
await self.sleep(1) # give the reconnect task time to start up
if self.eio.state == 'connected': # connected during await self.sleep(1)
continue
if not self._reconnect_task:
if self.eio.state == 'connected': # pragma: no cover
# connected while sleeping above
continue
break
await self._reconnect_task
if self.eio.state != 'connected':

7
src/socketio/client.py

@ -179,9 +179,12 @@ class Client(base_client.BaseClient):
while True:
self.eio.wait()
self.sleep(1) # give the reconnect task time to start up
if self.eio.state != 'connected': # reconnect task finished while `self.sleep(1)` was executing
continue
if not self._reconnect_task:
if self.eio.state == 'connected': # pragma: no cover
# connected while sleeping above
continue
else:
# the reconnect task gave up
break
self._reconnect_task.join()
if self.eio.state != 'connected':

Loading…
Cancel
Save