Skip to content

Commit 288ebb1

Browse files
Eliminate race conditions on disconnect (Fixes #1441)
1 parent 4adebf6 commit 288ebb1

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/socketio/async_client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ async def wait(self):
191191
if not self._reconnect_task:
192192
if self.eio.state == 'connected': # pragma: no cover
193193
# connected while sleeping above
194+
print('oops')
194195
continue
195196
break
196197
await self._reconnect_task
@@ -324,7 +325,7 @@ async def disconnect(self):
324325
for n in self.namespaces:
325326
await self._send_packet(self.packet_class(packet.DISCONNECT,
326327
namespace=n))
327-
await self.eio.disconnect(abort=True)
328+
await self.eio.disconnect()
328329

329330
async def shutdown(self):
330331
"""Stop the client.

src/socketio/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def disconnect(self):
306306
for n in self.namespaces:
307307
self._send_packet(self.packet_class(
308308
packet.DISCONNECT, namespace=n))
309-
self.eio.disconnect(abort=True)
309+
self.eio.disconnect()
310310

311311
def shutdown(self):
312312
"""Stop the client.

tests/async/test_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ async def test_disconnect(self):
475475
c._send_packet.await_args_list[0][0][0].encode()
476476
== expected_packet.encode()
477477
)
478-
c.eio.disconnect.assert_awaited_once_with(abort=True)
478+
c.eio.disconnect.assert_awaited_once_with()
479479

480480
async def test_disconnect_namespaces(self):
481481
c = async_client.AsyncClient()
@@ -993,7 +993,7 @@ async def test_shutdown_disconnect(self):
993993
c._send_packet.await_args_list[0][0][0].encode()
994994
== expected_packet.encode()
995995
)
996-
c.eio.disconnect.assert_awaited_once_with(abort=True)
996+
c.eio.disconnect.assert_awaited_once_with()
997997

998998
async def test_shutdown_disconnect_namespaces(self):
999999
c = async_client.AsyncClient()

tests/common/test_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def test_disconnect(self):
633633
c._send_packet.call_args_list[0][0][0].encode()
634634
== expected_packet.encode()
635635
)
636-
c.eio.disconnect.assert_called_once_with(abort=True)
636+
c.eio.disconnect.assert_called_once_with()
637637

638638
def test_disconnect_namespaces(self):
639639
c = client.Client()
@@ -1138,7 +1138,7 @@ def test_shutdown_disconnect(self):
11381138
c._send_packet.call_args_list[0][0][0].encode()
11391139
== expected_packet.encode()
11401140
)
1141-
c.eio.disconnect.assert_called_once_with(abort=True)
1141+
c.eio.disconnect.assert_called_once_with()
11421142

11431143
def test_shutdown_disconnect_namespaces(self):
11441144
c = client.Client()

0 commit comments

Comments
 (0)