Permalink
Browse files

Fire shutdown event from main loop

  • Loading branch information...
1 parent 53738a9 commit f594c7b20586f8015c33969720ceac95dbab2ce9 @stiletto stiletto committed Aug 6, 2012
Showing with 5 additions and 1 deletion.
  1. +2 −1 tornado/platform/twisted.py
  2. +3 −0 tornado/test/twisted_test.py
@@ -281,7 +281,8 @@ def getWriters(self):
# 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)
@@ -196,6 +196,9 @@ def close(self):
def fileno(self):
return self._fd.fileno()
+ def readConnectionLost(self, reason):
+ self.close()
+
def connectionLost(self, reason):
self.close()

0 comments on commit f594c7b

Please sign in to comment.