|
|
@ -191,7 +191,7 @@ class AsyncServer(server.Server): |
|
|
|
def event_callback(*args): |
|
|
|
callback_args.append(args) |
|
|
|
callback_event.set() |
|
|
|
|
|
|
|
|
|
|
|
await self.emit(event, data=data, room=sid, namespace=namespace, |
|
|
|
callback=event_callback, **kwargs) |
|
|
|
try: |
|
|
@ -201,7 +201,7 @@ class AsyncServer(server.Server): |
|
|
|
return callback_args[0] if len(callback_args[0]) > 1 \ |
|
|
|
else callback_args[0][0] if len(callback_args[0]) == 1 \ |
|
|
|
else None |
|
|
|
|
|
|
|
|
|
|
|
async def close_room(self, room, namespace=None): |
|
|
|
"""Close a room. |
|
|
|
|
|
|
@ -368,17 +368,17 @@ class AsyncServer(server.Server): |
|
|
|
"""Handle a client connection request.""" |
|
|
|
namespace = namespace or '/' |
|
|
|
self.manager.connect(sid, namespace) |
|
|
|
await self._send_packet(sid, packet.Packet(packet.CONNECT, |
|
|
|
namespace=namespace)) |
|
|
|
if await self._trigger_event('connect', namespace, sid, |
|
|
|
self.environ[sid]) is False: |
|
|
|
self.manager.disconnect(sid, namespace) |
|
|
|
await self._send_packet(sid, packet.Packet(packet.ERROR, |
|
|
|
self.manager.pre_disconnect(sid, namespace) |
|
|
|
await self._send_packet(sid, packet.Packet(packet.DISCONNECT, |
|
|
|
namespace=namespace)) |
|
|
|
self.manager.disconnect(sid, namespace) |
|
|
|
if sid in self.environ: # pragma: no cover |
|
|
|
del self.environ[sid] |
|
|
|
return False |
|
|
|
else: |
|
|
|
await self._send_packet(sid, packet.Packet(packet.CONNECT, |
|
|
|
namespace=namespace)) |
|
|
|
|
|
|
|
async def _handle_disconnect(self, sid, namespace): |
|
|
|
"""Handle a client disconnect.""" |
|
|
|