mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
patch from @asenchi fixing broken pipes. thanks!
This commit is contained in:
parent
a5379e67fa
commit
6f5b16ab91
@ -122,7 +122,7 @@ class Arbiter(object):
|
|||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.set_sockopts(sock)
|
self.set_sockopts(sock)
|
||||||
sock.bind(address)
|
sock.bind(address)
|
||||||
sock.listen(1024)
|
sock.listen(2048)
|
||||||
return sock
|
return sock
|
||||||
|
|
||||||
def set_sockopts(self, sock):
|
def set_sockopts(self, sock):
|
||||||
|
|||||||
@ -68,11 +68,17 @@ def read_partial(sock, length):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def write(sock, data):
|
def write(sock, data):
|
||||||
for i in range(2):
|
buf = ""
|
||||||
|
buf += data
|
||||||
|
while buf:
|
||||||
try:
|
try:
|
||||||
return sock.send(data)
|
bytes = sock.send(buf)
|
||||||
|
buf = buf[bytes:]
|
||||||
|
return bytes
|
||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
if i == 0:
|
if e[0] in (errno.EWOULDBLOCK, errno.EAGAIN):
|
||||||
|
break
|
||||||
|
elif e[0] in (errno.EPIPE,):
|
||||||
continue
|
continue
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user