mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fix a bug spotted while testin parser in restkit.
This commit is contained in:
parent
a461817309
commit
46e8002ffc
@ -95,7 +95,10 @@ class ChunkedReader(object):
|
|||||||
raise InvalidChunkSize(chunk_size)
|
raise InvalidChunkSize(chunk_size)
|
||||||
|
|
||||||
if chunk_size == 0:
|
if chunk_size == 0:
|
||||||
self.parse_trailers(unreader, rest_chunk)
|
try:
|
||||||
|
self.parse_trailers(unreader, rest_chunk)
|
||||||
|
except NoMoreData:
|
||||||
|
pass
|
||||||
return (0, None)
|
return (0, None)
|
||||||
return (chunk_size, rest_chunk)
|
return (chunk_size, rest_chunk)
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class ParseException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
class NoMoreData(ParseException):
|
class NoMoreData(ParseException):
|
||||||
def __init__(self, buf):
|
def __init__(self, buf=None):
|
||||||
self.buf = buf
|
self.buf = buf
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "No more data after: %r" % self.buf
|
return "No more data after: %r" % self.buf
|
||||||
|
|||||||
@ -40,11 +40,9 @@ class GEventWorker(AsyncWorker):
|
|||||||
gevent.kill(acceptor)
|
gevent.kill(acceptor)
|
||||||
break
|
break
|
||||||
gevent.sleep(0.1)
|
gevent.sleep(0.1)
|
||||||
|
pool.join(timeout=self.timeout)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
pool.join(timeout=self.timeout)
|
|
||||||
os._exit(3)
|
os._exit(3)
|
||||||
|
|
||||||
def acceptor(self, pool):
|
def acceptor(self, pool):
|
||||||
@ -56,8 +54,6 @@ class GEventWorker(AsyncWorker):
|
|||||||
gt._conn = conn
|
gt._conn = conn
|
||||||
gt.link(self.cleanup)
|
gt.link(self.cleanup)
|
||||||
conn, addr, gt = None, None, None
|
conn, addr, gt = None, None, None
|
||||||
except KeyboardInterrupt:
|
|
||||||
return
|
|
||||||
except greenlet.GreenletExit:
|
except greenlet.GreenletExit:
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user