diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2016-06-02 16:52:27 -0600 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2016-06-03 14:13:08 -0600 |
commit | c318f753bcc128910afbb49d1ce4801f758848bb (patch) | |
tree | 81c4430cf14a717bea1334c6c15f755d9925ec32 | |
parent | f7e9bf8c73602b15ab3a5c5d5b3381309fd12cef (diff) | |
download | waitress-c318f753bcc128910afbb49d1ce4801f758848bb.tar.gz |
Start up multiple TcpWSGIServer's
This way waitress can listen on multiple sockets at the same time.
-rw-r--r-- | waitress/server.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/waitress/server.py b/waitress/server.py index 3973c85..d81ba61 100644 --- a/waitress/server.py +++ b/waitress/server.py @@ -59,6 +59,25 @@ def create_server(application, adj=adj, sockinfo=sockinfo) + effective_listen = [] + last_serv = None + for sockinfo in adj.listen: + last_serv = TcpWSGIServer( + application, + map, + _start, + _sock, + dispatcher=dispatcher, + adj=adj, + sockinfo=sockinfo) + effective_listen.append((last_serv.effective_host, last_serv.effective_port)) + + # We are running a single server, so we can just return it... + if len(adj.listen) == 1: + return last_serv + + return BaseServer(map, adj, effective_listen) + class BaseServer(object): asyncore = asyncore # test shim |