Skip to content

Commit

Permalink
gunicorn worker should use create_unix_server for AF_UNIX sockets. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 authored and asvetlov committed Nov 7, 2016
1 parent 113261f commit db077f1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions aiohttp/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import re
import signal
import socket
import ssl
import sys

Expand Down Expand Up @@ -88,8 +89,13 @@ def _run(self):

for sock in self.sockets:
handler = self.make_handler(self.wsgi)
srv = yield from self.loop.create_server(handler, sock=sock.sock,
ssl=ctx)

if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX:
srv = yield from self.loop.create_unix_server(
handler, sock=sock.sock, ssl=ctx)
else:
srv = yield from self.loop.create_server(
handler, sock=sock.sock, ssl=ctx)
self.servers[srv] = handler

# If our parent changed then we shut down.
Expand Down

0 comments on commit db077f1

Please sign in to comment.