diff --git a/portal/__init__.py b/portal/__init__.py index 8ba781a..0f0667d 100644 --- a/portal/__init__.py +++ b/portal/__init__.py @@ -1,4 +1,4 @@ -__version__ = '3.2.0' +__version__ = '3.2.1' import multiprocessing as mp try: diff --git a/portal/server.py b/portal/server.py index 44e995a..ab87fb8 100644 --- a/portal/server.py +++ b/portal/server.py @@ -148,4 +148,7 @@ def _error(self, addr, reqnum, status, message): data = message.encode('utf-8') self.socket.send(addr, reqnum, status, data) if self.errors: + # Wait until the error is delivered to the client and then raise. + self.socket.shutdown() + self.socket.close() raise RuntimeError(message) diff --git a/portal/thread.py b/portal/thread.py index b5e9028..ee57880 100644 --- a/portal/thread.py +++ b/portal/thread.py @@ -21,7 +21,6 @@ class Thread: """ def __init__(self, fn, *args, name=None, start=False): - global TIDS self.fn = fn self.excode = None name = name or getattr(fn, '__name__', 'thread')