diff --git a/test/autobahn_test_servers.py b/test/autobahn_test_servers.py index 3e33f82..a0dbd42 100644 --- a/test/autobahn_test_servers.py +++ b/test/autobahn_test_servers.py @@ -142,7 +142,7 @@ def run_python_wsgi(host="127.0.0.1", port=9002): """ run_python_wsgi_async(host, port, False) -def run_python_wsgi_async(host="127.0.0.1", port=9010, async=True): +def run_python_wsgi_async(host="127.0.0.1", port=9010, non_blocking=True): """ Runs wsgi server on python 2.x with async middleware" """ @@ -153,7 +153,7 @@ def run_python_wsgi_async(host="127.0.0.1", port=9010, async=True): from ws4py.server.wsgiutils import WebSocketWSGIApplication app = WebSocketWSGIApplication(handler_cls=EchoWebSocket) - if async: + if non_blocking: def middleware(app): def later(environ, start_response): for part in app(environ, start_response): @@ -274,4 +274,3 @@ def later(environ, start_response): for p in procs: p.join() - diff --git a/ws4py/async_websocket.py b/ws4py/async_websocket.py index 9e2a4c7..ea296b4 100644 --- a/ws4py/async_websocket.py +++ b/ws4py/async_websocket.py @@ -84,7 +84,7 @@ def close_connection(self): def closeit(): yield from self.proto.writer.drain() self.proto.writer.close() - asyncio.async(closeit()) + asyncio.ensure_future(closeit()) def _write(self, data): """ @@ -94,7 +94,7 @@ def _write(self, data): def sendit(data): self.proto.writer.write(data) yield from self.proto.writer.drain() - asyncio.async(sendit(data)) + asyncio.ensure_future(sendit(data)) @asyncio.coroutine def run(self): diff --git a/ws4py/server/tulipserver.py b/ws4py/server/tulipserver.py index 2786c16..85312a2 100644 --- a/ws4py/server/tulipserver.py +++ b/ws4py/server/tulipserver.py @@ -40,7 +40,7 @@ def connection_made(self, transport): #self.stream.set_transport(transport) asyncio.StreamReaderProtocol.connection_made(self, transport) # Let make it concurrent for others to tag along - f = asyncio.async(self.handle_initial_handshake()) + f = asyncio.ensure_future(self.handle_initial_handshake()) f.add_done_callback(self.terminated) @property