make sure a listener is inheritable

fix #978
This commit is contained in:
Benoit Chesneau 2015-03-06 10:17:26 +01:00
parent eb485d2134
commit 30177b879a

View File

@ -41,6 +41,11 @@ class BaseSocket(object):
if not bound:
self.bind(sock)
sock.setblocking(0)
# make sure that the socket can be inherited
if hasattr(sock, "set_inheritable"):
sock.set_inheritable(True)
sock.listen(self.conf.backlog)
return sock
@ -110,6 +115,7 @@ class UnixSocket(BaseSocket):
util.chown(self.cfg_addr, self.conf.uid, self.conf.gid)
os.umask(old_umask)
def close(self):
super(UnixSocket, self).close()
os.unlink(self.cfg_addr)