mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Be explicit about blocking status.
Apparently the assumption that sockets don't inherit their blocking status from the server socket is invalid. Or python sets the flags to match. Either way, we need clients to use blocking sockets so we're now explicitly setting the blocking status.
This commit is contained in:
parent
61a84eece3
commit
8b9cb09b6b
@ -97,12 +97,17 @@ class Worker(object):
|
||||
def accept(self):
|
||||
try:
|
||||
client, addr = self.socket.accept()
|
||||
self.init_sock(client)
|
||||
self.handle(client, addr)
|
||||
self.nr += 1
|
||||
except socket.error, e:
|
||||
if e[0] not in (errno.EAGAIN, errno.ECONNABORTED):
|
||||
raise
|
||||
|
||||
def init_sock(self, sock):
|
||||
sock.setblocking(1)
|
||||
util.close_on_exec(sock)
|
||||
|
||||
def run(self):
|
||||
self.init_process()
|
||||
self.nr = 0
|
||||
@ -145,7 +150,6 @@ class Worker(object):
|
||||
raise
|
||||
|
||||
def handle(self, client, addr):
|
||||
util.close_on_exec(client)
|
||||
try:
|
||||
req = http.Request(client, addr, self.address, self.conf)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user