Fix a bug spotted while testin parser in restkit.

This commit is contained in:
benoitc 2010-06-26 22:53:18 +02:00
parent a461817309
commit 46e8002ffc
3 changed files with 7 additions and 8 deletions

View File

@ -95,7 +95,10 @@ class ChunkedReader(object):
raise InvalidChunkSize(chunk_size)
if chunk_size == 0:
self.parse_trailers(unreader, rest_chunk)
try:
self.parse_trailers(unreader, rest_chunk)
except NoMoreData:
pass
return (0, None)
return (chunk_size, rest_chunk)

View File

@ -7,7 +7,7 @@ class ParseException(Exception):
pass
class NoMoreData(ParseException):
def __init__(self, buf):
def __init__(self, buf=None):
self.buf = buf
def __str__(self):
return "No more data after: %r" % self.buf

View File

@ -39,12 +39,10 @@ class GEventWorker(AsyncWorker):
self.log.info("Parent changed, shutting down: %s" % self)
gevent.kill(acceptor)
break
gevent.sleep(0.1)
gevent.sleep(0.1)
pool.join(timeout=self.timeout)
except KeyboardInterrupt:
pass
pool.join(timeout=self.timeout)
os._exit(3)
def acceptor(self, pool):
@ -56,8 +54,6 @@ class GEventWorker(AsyncWorker):
gt._conn = conn
gt.link(self.cleanup)
conn, addr, gt = None, None, None
except KeyboardInterrupt:
return
except greenlet.GreenletExit:
return
except: