summaryrefslogtreecommitdiff
path: root/scripts/NetworkProxy.py
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-11-30 15:22:26 +0100
committerBenoit Foucher <benoit@zeroc.com>2016-11-30 15:22:26 +0100
commit7b88a5e3be7e88eef2cbf053fcc6b673de858321 (patch)
treed2e9068e0acb88790df60a44e0b3bfe784bcd124 /scripts/NetworkProxy.py
parentFixes to run IceGrid test with Windows bindist in debug mode (diff)
downloadice-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.py34
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: