# Don't join currentThread (when stop is called inside a request).
current = threading.currentThread()
+ if timeout and timeout >= 0:
+ endtime = time.time() + timeout
worker = self._threads.pop()
if worker is not current and worker.isAlive():
if timeout is None or timeout < 0:
+ remaining_time = endtime - time.time()
# We exhausted the timeout.
# Forcibly shut down the socket.