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)
|
||||
self.set_sockopts(sock)
|
||||
sock.bind(address)
|
||||
sock.listen(1024)
|
||||
sock.listen(2048)
|
||||
return sock
|
||||
|
||||
def set_sockopts(self, sock):
|
||||
|
||||
@ -68,11 +68,17 @@ def read_partial(sock, length):
|
||||
return data
|
||||
|
||||
def write(sock, data):
|
||||
for i in range(2):
|
||||
buf = ""
|
||||
buf += data
|
||||
while buf:
|
||||
try:
|
||||
return sock.send(data)
|
||||
bytes = sock.send(buf)
|
||||
buf = buf[bytes:]
|
||||
return bytes
|
||||
except socket.error, e:
|
||||
if i == 0:
|
||||
if e[0] in (errno.EWOULDBLOCK, errno.EAGAIN):
|
||||
break
|
||||
elif e[0] in (errno.EPIPE,):
|
||||
continue
|
||||
raise
|
||||
|
||||
@ -116,4 +122,4 @@ def http_date(timestamp=None):
|
||||
weekdayname[wd],
|
||||
day, monthname[month], year,
|
||||
hh, mm, ss)
|
||||
return s
|
||||
return s
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user