Agent: Add try/except block in _calculate_timeout in MonkeyTunnel

This commit is contained in:
Shreya Malviya 2022-04-07 19:14:24 +05:30
parent c9b9a27c34
commit 2e087cf521
1 changed files with 5 additions and 2 deletions

View File

@ -200,8 +200,11 @@ class MonkeyTunnel(Thread):
proxy.stop() proxy.stop()
proxy.join() proxy.join()
def _calculate_timeout(self): def _calculate_timeout(self) -> float:
try:
return QUIT_TIMEOUT - (time.time() - get_last_serve_time()) return QUIT_TIMEOUT - (time.time() - get_last_serve_time())
except TypeError: # get_last_serve_time() may return None
return 0.0
def get_tunnel_for_ip(self, ip: str): def get_tunnel_for_ip(self, ip: str):