Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions test/autobahn_test_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
"""
Expand All @@ -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):
Expand Down Expand Up @@ -274,4 +274,3 @@ def later(environ, start_response):

for p in procs:
p.join()

4 changes: 2 additions & 2 deletions ws4py/async_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion ws4py/server/tulipserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down