Permalink
Browse files

Add auto start parameter to socket server

  • Loading branch information...
1 parent f61b83f commit c364054c8ef301c14afdef4667b3638fdbd1e35f @kachayev kachayev committed Oct 23, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 tornadio/server.py
View
11 tornadio/server.py
@@ -25,7 +25,8 @@ class SocketServer(HTTPServer):
def __init__(self, application,
no_keep_alive=False, io_loop=None,
- xheaders=False, ssl_options=None
+ xheaders=False, ssl_options=None,
+ auto_start=True
):
"""Initializes the server with the given request callback.
@@ -67,5 +68,9 @@ def __init__(self, application,
except Exception, ex:
logging.error('Failed to start Flash policy server: %s', ex)
- logging.info('Entering IOLoop...')
- io_loop.start()
+ # Set auto_start to False in order to have opportunities
+ # to work with server object and/or perform some actions
+ # after server already created but before ioloop will start
+ if auto_start:
+ logging.info('Entering IOLoop...')
+ io_loop.start()

0 comments on commit c364054

Please sign in to comment.