From 1ac5e26122e91ef5a658524ebfe885a332307a51 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Fri, 29 Jan 2016 18:19:37 +0200 Subject: [PATCH] Add support for unix domain sockets to gunicorn worker #470 --- CHANGES.txt | 2 ++ aiohttp/worker.py | 6 ++---- tests/test_worker.py | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 203ee1c5d80..d59b597b13b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -64,3 +64,5 @@ CHANGES - Close client connection on exception in ClientResponse.release() - Allow to read multipart parts without content-length specified #750 + +- Add support for unix domain sockets to gunicorn worker #470 diff --git a/aiohttp/worker.py b/aiohttp/worker.py index 0229c3f1e0e..593962d3a4c 100644 --- a/aiohttp/worker.py +++ b/aiohttp/worker.py @@ -39,15 +39,13 @@ def run(self): sys.exit(self.exit_code) - def make_handler(self, app, host, port): + def make_handler(self, app): if hasattr(self.cfg, 'debug'): is_debug = self.cfg.debug else: is_debug = self.log.loglevel == logging.DEBUG return app.make_handler( - host=host, - port=port, logger=self.log, debug=is_debug, timeout=self.cfg.timeout, @@ -83,7 +81,7 @@ def close(self): @asyncio.coroutine def _run(self): for sock in self.sockets: - handler = self.make_handler(self.wsgi, *sock.cfg_addr) + handler = self.make_handler(self.wsgi) srv = yield from self.loop.create_server(handler, sock=sock.sock) self.servers[srv] = handler diff --git a/tests/test_worker.py b/tests/test_worker.py index efc0ea593e5..492d6269352 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -68,8 +68,7 @@ def test_make_handler(worker): worker.log = mock.Mock() worker.cfg = mock.Mock() - f = worker.make_handler( - worker.wsgi, 'localhost', 8080) + f = worker.make_handler(worker.wsgi) assert f is worker.wsgi.make_handler.return_value