Fixed 2.0 client bugs

This commit is contained in:
Adolfo Gómez García 2016-04-13 07:24:41 +02:00
parent 9cd7e2f67b
commit abc9622d53
2 changed files with 11 additions and 4 deletions

View File

@ -65,10 +65,11 @@ class Handler(SocketServer.BaseRequestHandler):
except Exception:
pass
if self.thread.stoppable is True:
self.thread.currentConnections -= 1
if self.thread.stoppable is True and self.thread.currentConnections == 0:
self.thread.stop()
self.thread.currentConnections -= 1
class ForwardThread(threading.Thread):
status = 0 # Connecting

View File

@ -65,7 +65,7 @@ def readTempFile(filename):
filename = os.path.join(tempfile.gettempdir(), filename)
try:
with open(filename, 'w') as f:
with open(filename, 'r') as f:
return f.read()
except Exception:
return None
@ -129,7 +129,13 @@ def addTaskToWait(taks):
def waitForTasks():
for t in _tasksToWait:
t.wait()
try:
if hasattr(t, 'join'):
t.join()
elif hasattr(t, 'wait'):
t.wait()
except Exception:
pass
def addExecBeforeExit(fnc):