diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-11-28 19:09:27 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-11-28 19:09:27 +0100 |
commit | 69530abfeac2165324b3abe06cd60bfbd5f84b7f (patch) | |
tree | 32bb599df768d0a9d3f7ec9a6b8293256bf9315f /scripts/NetworkProxy.py | |
parent | Python 3 test suite fixes (diff) | |
download | ice-69530abfeac2165324b3abe06cd60bfbd5f84b7f.tar.bz2 ice-69530abfeac2165324b3abe06cd60bfbd5f84b7f.tar.xz ice-69530abfeac2165324b3abe06cd60bfbd5f84b7f.zip |
Fixed networkProxy, IceGrid/admin, metrics test failures
Diffstat (limited to 'scripts/NetworkProxy.py')
-rw-r--r-- | scripts/NetworkProxy.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/NetworkProxy.py b/scripts/NetworkProxy.py index e33bc19414a..9b31ab614dd 100644 --- a/scripts/NetworkProxy.py +++ b/scripts/NetworkProxy.py @@ -7,14 +7,13 @@ # # ********************************************************************** -import sys, os, threading, socket, select, atexit +import sys, os, threading, socket, select class InvalidRequest(Exception): pass class BaseConnection(threading.Thread): def __init__(self, socket, remote): threading.Thread.__init__(self) - self.setDaemon(True) self.socket = socket self.remote = remote self.remoteSocket = None @@ -27,6 +26,8 @@ class BaseConnection(threading.Thread): pass def close(self): + if self.closed: + return self.closed = True try: if self.socket: @@ -81,8 +82,6 @@ class BaseProxy(threading.Thread): self.socket = None self.failed = None self.connections = [] - atexit.register(self.terminate) - self.setDaemon(True) self.start() with self.cond: while not self.socket and not self.failed: @@ -126,6 +125,7 @@ class BaseProxy(threading.Thread): for c in self.connections: try: c.close() + c.join() except Exception as ex: print(ex) @@ -137,6 +137,8 @@ class BaseProxy(threading.Thread): finally: connectToSelf.close() + self.join() + class SocksConnection(BaseConnection): def request(self, s): |