MCPcopy
hub / github.com/benoitc/gunicorn / set_options

Method set_options

gunicorn/sock.py:42–60  ·  view source on GitHub ↗
(self, sock, bound=False)

Source from the content-addressed store, hash-verified

40 return getattr(self.sock, name)
41
42 def set_options(self, sock, bound=False):
43 sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
44 if (self.conf.reuse_port
45 and hasattr(socket, 'SO_REUSEPORT')): # pragma: no cover
46 try:
47 sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
48 except OSError as err:
49 if err.errno not in (errno.ENOPROTOOPT, errno.EINVAL):
50 raise
51 if not bound:
52 self.bind(sock)
53 sock.setblocking(0)
54
55 # make sure that the socket can be inherited
56 if hasattr(sock, "set_inheritable"):
57 sock.set_inheritable(True)
58
59 sock.listen(self.conf.backlog)
60 return sock
61
62 def bind(self, sock):
63 sock.bind(self.cfg_addr)

Callers 1

__init__Method · 0.95

Calls 2

bindMethod · 0.95
setblockingMethod · 0.45

Tested by

no test coverage detected