mirror of
https://github.com/django/daphne.git
synced 2024-11-21 23:46:33 +03:00
Unix socket fix (#161)
Fix error on listeners when passing a unix socket
This commit is contained in:
parent
3bffe981f6
commit
d46429247f
|
@ -131,7 +131,9 @@ class Server(object):
|
|||
Called when a listen succeeds so we can store port details (if there are any)
|
||||
"""
|
||||
if hasattr(port, "getHost"):
|
||||
self.listening_addresses.append((port.getHost().host, port.getHost().port))
|
||||
host = port.getHost()
|
||||
if hasattr(host, "host") and hasattr(host, "port"):
|
||||
self.listening_addresses.append((host.host, host.port))
|
||||
|
||||
def listen_error(self, failure):
|
||||
logger.critical("Listen failure: %s", failure.getErrorMessage())
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import errno
|
||||
import random
|
||||
import socket
|
||||
import struct
|
||||
|
@ -31,7 +32,7 @@ class DaphneTestingInstance:
|
|||
try:
|
||||
s.bind(("127.0.0.1", port))
|
||||
except socket.error as e:
|
||||
if e.errno in [13, 98]:
|
||||
if e.errno in [errno.EACCES, errno.EADDRINUSE]:
|
||||
return True
|
||||
else:
|
||||
raise
|
||||
|
|
Loading…
Reference in New Issue
Block a user