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. 9
      src/socketio/client.py

5
src/socketio/async_client.py

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

9
src/socketio/client.py

@ -179,10 +179,13 @@ class Client(base_client.BaseClient):
while True: while True:
self.eio.wait() self.eio.wait()
self.sleep(1) # give the reconnect task time to start up 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 not self._reconnect_task:
break if self.eio.state == 'connected': # pragma: no cover
# connected while sleeping above
continue
else:
# the reconnect task gave up
break
self._reconnect_task.join() self._reconnect_task.join()
if self.eio.state != 'connected': if self.eio.state != 'connected':
break break

Loading…
Cancel
Save