Skip to content
This repository
Browse code

Fire shutdown event from main loop

  • Loading branch information...
commit f594c7b20586f8015c33969720ceac95dbab2ce9 1 parent 53738a9
stiletto authored August 06, 2012
3  tornado/platform/twisted.py
@@ -281,7 +281,8 @@ def getWriters(self):
281 281
     # IOLoop.start() instead of Reactor.run().
282 282
     def stop(self):
283 283
         PosixReactorBase.stop(self)
284  
-        self.fireSystemEvent("shutdown")
  284
+        fire_shutdown = functools.partial(self.fireSystemEvent,"shutdown")
  285
+        self._io_loop.add_callback(fire_shutdown)
285 286
 
286 287
     def crash(self):
287 288
         PosixReactorBase.crash(self)
3  tornado/test/twisted_test.py
@@ -196,6 +196,9 @@ def close(self):
196 196
     def fileno(self):
197 197
         return self._fd.fileno()
198 198
 
  199
+    def readConnectionLost(self, reason):
  200
+        self.close()
  201
+
199 202
     def connectionLost(self, reason):
200 203
         self.close()
201 204
 

0 notes on commit f594c7b

Please sign in to comment.
Something went wrong with that request. Please try again.