Use spawn_callback method to handle connection
This commit is contained in:
parent
d4a27c0655
commit
cca38e01c5
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue