mirror of https://github.com/craigerl/aprsd.git
Merge branch 'master' into py3
This commit is contained in:
commit
a3813eaf3a
|
@ -116,7 +116,8 @@ def setup_connection():
|
||||||
try:
|
try:
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
sock.connect((CONFIG['aprs']['host'], 14580))
|
sock.connect((CONFIG['aprs']['host'], 14580))
|
||||||
sock.settimeout(60)
|
|
||||||
|
sock.settimeout(300)
|
||||||
connected = True
|
connected = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Unable to connect to APRS-IS server.\n")
|
print("Unable to connect to APRS-IS server.\n")
|
||||||
|
@ -129,6 +130,7 @@ def setup_connection():
|
||||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 512) # buffer size
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 512) # buffer size
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def signal_handler(signal, frame):
|
def signal_handler(signal, frame):
|
||||||
LOG.info("Ctrl+C, exiting.")
|
LOG.info("Ctrl+C, exiting.")
|
||||||
# sys.exit(0) # thread ignores this
|
# sys.exit(0) # thread ignores this
|
||||||
|
@ -607,11 +609,13 @@ def main(args=args):
|
||||||
|
|
||||||
user = CONFIG['aprs']['login']
|
user = CONFIG['aprs']['login']
|
||||||
password = CONFIG['aprs']['password']
|
password = CONFIG['aprs']['password']
|
||||||
|
|
||||||
LOG.debug("LOGIN to APRSD with user '%s'" % user)
|
LOG.debug("LOGIN to APRSD with user '%s'" % user)
|
||||||
msg = ("user {} pass {} vers aprsd {}\n".format(user, password,
|
msg = ("user {} pass {} vers aprsd {}\n".format(user, password,
|
||||||
aprsd.__version__))
|
aprsd.__version__))
|
||||||
sock.send(msg.encode())
|
sock.send(msg.encode())
|
||||||
|
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
check_email_delay = 60 # initial email check interval
|
check_email_delay = 60 # initial email check interval
|
||||||
|
@ -791,6 +795,7 @@ def main(args=args):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error("Error in mainline loop:")
|
LOG.error("Error in mainline loop:")
|
||||||
LOG.error("%s" % str(e))
|
LOG.error("%s" % str(e))
|
||||||
|
|
||||||
if (str(e) == "timed out" or str(e) == "Temporary failure in name resolution" or str(e) == "Network is unreachable"):
|
if (str(e) == "timed out" or str(e) == "Temporary failure in name resolution" or str(e) == "Network is unreachable"):
|
||||||
LOG.error("Attempting to reconnect.")
|
LOG.error("Attempting to reconnect.")
|
||||||
sock.shutdown(0)
|
sock.shutdown(0)
|
||||||
|
@ -800,6 +805,7 @@ def main(args=args):
|
||||||
continue
|
continue
|
||||||
# LOG.error("Exiting.")
|
# LOG.error("Exiting.")
|
||||||
# os._exit(1)
|
# os._exit(1)
|
||||||
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
continue # don't know what failed, so wait and then continue main loop again
|
continue # don't know what failed, so wait and then continue main loop again
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue