]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add basic error checking so you can't add a server to the IOLoop twice
authorBret Taylor <btaylor@btaylor-mac.local>
Wed, 9 Dec 2009 09:48:50 +0000 (01:48 -0800)
committerBret Taylor <btaylor@btaylor-mac.local>
Wed, 9 Dec 2009 09:48:50 +0000 (01:48 -0800)
tornado/httpserver.py

index ae23c9dfefd164cde35a30615bd36ad65920c270..9f0dfee10968288b09c1f2fa9324280258be1e3d 100644 (file)
@@ -113,6 +113,7 @@ class HTTPServer(object):
         self.xheaders = xheaders
         self.ssl_options = ssl_options
         self._socket = None
+        self._started = False
 
     def listen(self, port, address=""):
         """Binds to the given port and starts the server in a single process.
@@ -156,6 +157,8 @@ class HTTPServer(object):
         Since we run use processes and not threads, there is no shared memory
         between any server code.
         """
+        assert not self._started
+        self._started = True
         if num_processes is None:
             # Use sysconf to detect the number of CPUs (cores)
             try: