浏览代码

await and async are forbidden in __init__. now calling on_welcome from server.handle_client

digital 7 年之前
父节点
当前提交
66c878abbd
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      network/__init__.py

+ 2 - 2
network/__init__.py

@@ -116,8 +116,6 @@ class ConnHandler(object):
     """
     def __init__(self, socket, addr, server):
         super(ConnHandler, self).__init__(socket,addr,server)
-        task = await curio.spawn(self.welcome_client)
-        task.join()
 
     async def disconnect(self):
         """
@@ -366,6 +364,8 @@ class Server(object):
         This method waits for the client to send something and calls the
         ClientHandler's handle method. there is a handle_client method running for each client connected.
         """
+        if hasattr(handler,"on_welcome"):
+            await handler.on_welcome()
         while True:
             try:
                 if self.log_ip: