diff --git a/unzoner/src/main.py b/unzoner/src/main.py index b9a2739..0cd812f 100755 --- a/unzoner/src/main.py +++ b/unzoner/src/main.py @@ -124,11 +124,7 @@ def main(): if s_msg[idx] in magic_lines: started[idx] = True starting[idx] = False - try: - log_server_stats(status=started) - except Exception as e: - print('exception-handler in {}: {}'.format(this, repr(e))) - if DEBUG: print_exc() + log_server_stats(status=started) if not started[idx] and not starting[idx]: if i == 1: # at the beginning of the cycle @@ -197,25 +193,11 @@ def main(): if DEVICE_TYPE == 3 and connected: # test if double-vpn is up try: shell_check_output_cmd('ip link | grep {}'.format(TUN_IFACE)) # raises exception if tunnel is down - geo_result = get_geo_location() - assert geo_result, '{}: double-vpn not ready'.format(this) - print('double-vpn-geo: {}'.format(geo_result)) log_server_stats(status=started) # server up only if double-vpn is up - except Exception as e: - print('exception-handler in {}: {}'.format(this, repr(e))) - if DEBUG: print_exc() - - try: - log_server_stats() # force server down if double-vpn is down - except Exception as e: - print('exception-handler in {}: {}'.format(this, repr(e))) - if DEBUG: print_exc() + except: + log_server_stats() # force server down if double-vpn is down else: - try: - log_server_stats(status=started) - except Exception as e: - print('exception-handler in {}: {}'.format(this, repr(e))) - if DEBUG: print_exc() + log_server_stats(status=started) s_status_line = 'server-status: cycle={} started={} starting={} s_pid={} s_conns={} AF={} hostAPd={} UPNP={}'.format( i, @@ -382,11 +364,7 @@ def main(): if c_msg in magic_lines: connected = True connecting = False - try: - log_client_stats(status=connected, country=c_country) - except Exception as e: - print('exception-handler in {}: {}'.format(this, repr(e))) - if DEBUG: print_exc() + log_client_stats(status=connected, country=c_country) if DEVICE_TYPE == 5: try: @@ -468,6 +446,7 @@ def main(): geo_result = get_geo_location() assert geo_result, '{}: client tunnel down'.format(this) print('client-vpn-geo: {}'.format(geo_result)) + if DEVICE_TYPE == 3: log_server_stats(status=started) # server up only if client-vpn is up except Exception as e: print('exception-handler in {}: {}'.format(this, repr(e))) if DEBUG: print_exc() @@ -476,13 +455,9 @@ def main(): c_proc.terminate() while c_proc.poll() is None: sleep(LOOP_TIMER) c_pid = None + if DEVICE_TYPE == 3: log_server_stats() # force server down if clienv-vpn is down - try: - log_client_stats(status=connected, country=c_country) - except Exception as e: - print('exception-handler in {}: {}'.format(this, repr(e))) - if DEBUG: print_exc() - + log_client_stats(status=connected, country=c_country) w_clnts = get_stations() c_status_line = 'client-status: cycle={} connected={} connecting={} c_proto={} c_pid={} w_clnts={} AF={} hostAPd={} UPNP={}'.format( i,