Use spawn_callback method to handle connection

This commit is contained in:
Peter Nelson 2018-08-14 18:29:30 -05:00
parent d4a27c0655
commit cca38e01c5
1 changed files with 2 additions and 3 deletions

View File

@ -67,7 +67,6 @@ class IOLoop(Configurable):
import socket
import tornado.ioloop
from tornado.gen import convert_yielded
from tornado.iostream import IOStream
async def handle_connection(connection, address):
@ -84,8 +83,8 @@ class IOLoop(Configurable):
raise
return
connection.setblocking(0)
coro = handle_connection(connection, address)
convert_yielded(coro)
io_loop = tornado.ioloop.IOLoop.current()
io_loop.spawn_callback(handle_connection, connection, address)
if __name__ == '__main__':
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)