2010-01-14 Yuzo Fujishima <yuzo@google.com>
[WebKit-https.git] / WebKitTools / pywebsocket / mod_pywebsocket / standalone.py
index 0a1736e..9822a75 100644 (file)
@@ -89,6 +89,8 @@ _LOG_LEVELS = {
 _DEFAULT_LOG_MAX_BYTES = 1024 * 256
 _DEFAULT_LOG_BACKUP_COUNT = 5
 
+_DEFAULT_REQUEST_QUEUE_SIZE = 128
+
 # 1024 is practically large enough to contain WebSocket handshake lines.
 _MAX_MEMORIZED_LINES = 1024
 
@@ -314,12 +316,17 @@ def _main():
                       help='Log backup count')
     parser.add_option('--strict', dest='strict', action='store_true',
                       default=False, help='Strictly check handshake request')
+    parser.add_option('-q', '--queue', dest='request_queue_size', type='int',
+                      default=_DEFAULT_REQUEST_QUEUE_SIZE,
+                      help='request queue size')
     options = parser.parse_args()[0]
 
     os.chdir(options.document_root)
 
     _configure_logging(options)
 
+    SocketServer.TCPServer.request_queue_size = options.request_queue_size
+
     if options.use_tls:
         if not _HAS_OPEN_SSL:
             logging.critical('To use TLS, install pyOpenSSL.')