mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
ease integration with grainbows, put accept connection in its own
method.
This commit is contained in:
parent
f2adef3d35
commit
275031f66a
@ -95,6 +95,15 @@ class Worker(object):
|
|||||||
self.init_signals()
|
self.init_signals()
|
||||||
|
|
||||||
|
|
||||||
|
def accept(self):
|
||||||
|
try:
|
||||||
|
client, addr = self.socket.accept()
|
||||||
|
self.handle(client, addr)
|
||||||
|
self.nr += 1
|
||||||
|
except socket.error, e:
|
||||||
|
if e[0] not in (errno.EAGAIN, errno.ECONNABORTED):
|
||||||
|
raise
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.init_process()
|
self.init_process()
|
||||||
self.nr = 0
|
self.nr = 0
|
||||||
@ -106,13 +115,9 @@ class Worker(object):
|
|||||||
while self.alive:
|
while self.alive:
|
||||||
self.nr = 0
|
self.nr = 0
|
||||||
self.notify()
|
self.notify()
|
||||||
try:
|
|
||||||
client, addr = self.socket.accept()
|
# accept a new connection
|
||||||
self.handle(client, addr)
|
self.accept()
|
||||||
self.nr += 1
|
|
||||||
except socket.error, e:
|
|
||||||
if e[0] not in (errno.EAGAIN, errno.ECONNABORTED):
|
|
||||||
raise
|
|
||||||
|
|
||||||
# Keep processing clients until no one is waiting.
|
# Keep processing clients until no one is waiting.
|
||||||
# This prevents the need to select() for every
|
# This prevents the need to select() for every
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user