]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Added the ability to stop an HTTPServer. Mostly for unittesting.
authorElias Torres <elias@manta.local>
Thu, 26 Nov 2009 05:30:58 +0000 (00:30 -0500)
committerBen Darnell <bdarnell@beaker.local>
Wed, 3 Feb 2010 20:07:56 +0000 (12:07 -0800)
tornado/httpserver.py

index 742cfc87205c58666e32048603c66f5a6f12950c..4e5ae76834856273f94cecc9cc879e47e713c1b3 100644 (file)
@@ -186,6 +186,10 @@ class HTTPServer(object):
             io_loop.add_handler(self._socket.fileno(), self._handle_events,
                                 ioloop.IOLoop.READ)
 
+    def stop(self):
+      self.io_loop.remove_handler(self._socket.fileno())
+      self._socket.close()
+
     def _handle_events(self, fd, events):
         while True:
             try: