diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-11-30 15:22:26 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-11-30 15:22:26 +0100 |
commit | 7b88a5e3be7e88eef2cbf053fcc6b673de858321 (patch) | |
tree | d2e9068e0acb88790df60a44e0b3bfe784bcd124 /scripts/NetworkProxy.py | |
parent | Fixes to run IceGrid test with Windows bindist in debug mode (diff) | |
download | ice-7b88a5e3be7e88eef2cbf053fcc6b673de858321.tar.bz2 ice-7b88a5e3be7e88eef2cbf053fcc6b673de858321.tar.xz ice-7b88a5e3be7e88eef2cbf053fcc6b673de858321.zip |
Removed Java controller, fixes to investiage IceGrid/replication test failure
Diffstat (limited to 'scripts/NetworkProxy.py')
-rw-r--r-- | scripts/NetworkProxy.py | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/scripts/NetworkProxy.py b/scripts/NetworkProxy.py index 9b31ab614dd..0ee9cc416e4 100644 --- a/scripts/NetworkProxy.py +++ b/scripts/NetworkProxy.py @@ -93,8 +93,8 @@ class BaseProxy(threading.Thread): return None def run(self): - try: - with self.cond: + with self.cond: + try: self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) if hasattr(socket, "SO_REUSEPORT"): @@ -102,32 +102,34 @@ class BaseProxy(threading.Thread): self.socket.bind(("127.0.0.1", self.port)) self.socket.listen(1) self.cond.notify() - except Exception as ex: - self.failed = ex - self.cond.notify() - return + except Exception as ex: + self.failed = ex + self.cond.notify() + return try: while not self.closed: incoming, peer = self.socket.accept() connection = self.createConnection(incoming, peer) connection.start() - self.connections.append(connection) + with self.cond: + self.connections.append(connection) except: pass finally: self.socket.close() def terminate(self): - if self.closed: - return - self.closed = True - for c in self.connections: - try: - c.close() - c.join() - except Exception as ex: - print(ex) + with self.cond: + if self.closed: + return + self.closed = True + for c in self.connections: + try: + c.close() + c.join() + except Exception as ex: + print(ex) connectToSelf = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: |