This commit is contained in:
Kovid Goyal 2015-05-22 21:51:30 +05:30
parent 67484ad5e9
commit 3967a1ebc1

View File

@ -189,7 +189,6 @@ class SocketFile(object): # {{{
buf.write(data) buf.write(data)
del data # explicit free del data # explicit free
break break
assert n <= left, "recv(%d) returned %d bytes" % (left, n)
buf.write(data) # noqa buf.write(data) # noqa
buf_len += n buf_len += n
del data # noqa explicit free del data # noqa explicit free
@ -507,13 +506,13 @@ class ThreadPool(object): # {{{
for worker in self._threads: for worker in self._threads:
self._queue.put(None) self._queue.put(None)
# Don't join currentThread (when stop is called inside a request). # Don't join the current thread (when stop is called inside a request).
current = current_thread() current = current_thread()
if timeout and timeout >= 0: if timeout and timeout >= 0:
endtime = time.time() + timeout endtime = time.time() + timeout
while self._threads: while self._threads:
worker = self._threads.pop() worker = self._threads.pop()
if worker is not current and worker.isAlive(): if worker is not current and worker.is_alive():
try: try:
if timeout is None or timeout < 0: if timeout is None or timeout < 0:
worker.join() worker.join()
@ -529,10 +528,8 @@ class ThreadPool(object): # {{{
c.socket.shutdown(socket.SHUT_RDWR) c.socket.shutdown(socket.SHUT_RDWR)
c.socket.close() c.socket.close()
worker.join() worker.join()
except (AssertionError, except KeyboardInterrupt:
# Ignore repeated Ctrl-C. pass # Ignore repeated Ctrl-C.
KeyboardInterrupt):
pass
@property @property
def qsize(self): def qsize(self):