]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fire shutdown event from main loop 574/head
authorStiletto <blasux@blasux.ru>
Mon, 6 Aug 2012 15:43:27 +0000 (19:43 +0400)
committerStiletto <blasux@blasux.ru>
Mon, 6 Aug 2012 15:58:58 +0000 (19:58 +0400)
tornado/platform/twisted.py
tornado/test/twisted_test.py

index 07ca8c58e54379f05f57cc423d3a2ab43579318f..935b6233ee61782351a3da16a9a2133c5daf8294 100644 (file)
@@ -281,7 +281,8 @@ class TornadoReactor(PosixReactorBase):
     # IOLoop.start() instead of Reactor.run().
     def stop(self):
         PosixReactorBase.stop(self)
-        self.fireSystemEvent("shutdown")
+        fire_shutdown = functools.partial(self.fireSystemEvent,"shutdown")
+        self._io_loop.add_callback(fire_shutdown)
 
     def crash(self):
         PosixReactorBase.crash(self)
index 327af2db7e0c0a2978e0a632d92630ae51a4e26a..152d227857b8db07acd4cb3ebeaf2891a31900fa 100644 (file)
@@ -196,6 +196,9 @@ class Reader(object):
     def fileno(self):
         return self._fd.fileno()
 
+    def readConnectionLost(self, reason):
+        self.close()
+
     def connectionLost(self, reason):
         self.close()