mirror of
https://github.com/craigerl/aprsd.git
synced 2024-12-19 16:15:57 -05:00
Added a fix for failed logins to APRS-IS
This patch adds a check for a failed login to ARPS due to LoginError. This accounts for bad accounts or username/password failures. aprsd server will exit immediately upon failed login now.
This commit is contained in:
parent
94708024da
commit
3dd23fa2ad
@ -17,6 +17,8 @@ class Client:
|
|||||||
aprs_client = None
|
aprs_client = None
|
||||||
config = None
|
config = None
|
||||||
|
|
||||||
|
connected = False
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
"""This magic turns this into a singleton."""
|
"""This magic turns this into a singleton."""
|
||||||
if cls._instance is None:
|
if cls._instance is None:
|
||||||
@ -55,6 +57,10 @@ class Client:
|
|||||||
aprs_client.connect()
|
aprs_client.connect()
|
||||||
connected = True
|
connected = True
|
||||||
backoff = 1
|
backoff = 1
|
||||||
|
except LoginError as e:
|
||||||
|
LOG.error("Failed to login to APRS-IS Server '{}'".format(e))
|
||||||
|
connected = False
|
||||||
|
raise e
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error("Unable to connect to APRS-IS server. '{}' ".format(e))
|
LOG.error("Unable to connect to APRS-IS server. '{}' ".format(e))
|
||||||
time.sleep(backoff)
|
time.sleep(backoff)
|
||||||
|
@ -34,6 +34,7 @@ import time
|
|||||||
import aprsd
|
import aprsd
|
||||||
from aprsd import client, email, messaging, plugin, threads, utils
|
from aprsd import client, email, messaging, plugin, threads, utils
|
||||||
import aprslib
|
import aprslib
|
||||||
|
from aprslib.exceptions import LoginError
|
||||||
import click
|
import click
|
||||||
import click_completion
|
import click_completion
|
||||||
import yaml
|
import yaml
|
||||||
@ -387,7 +388,11 @@ def server(loglevel, quiet, disable_validation, config_file, flush):
|
|||||||
# Create the initial PM singleton and Register plugins
|
# Create the initial PM singleton and Register plugins
|
||||||
plugin_manager = plugin.PluginManager(config)
|
plugin_manager = plugin.PluginManager(config)
|
||||||
plugin_manager.setup_plugins()
|
plugin_manager.setup_plugins()
|
||||||
client.Client(config)
|
try:
|
||||||
|
cl = client.Client(config)
|
||||||
|
cl.setup_connection()
|
||||||
|
except LoginError:
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
# Now load the msgTrack from disk if any
|
# Now load the msgTrack from disk if any
|
||||||
if flush:
|
if flush:
|
||||||
|
Loading…
Reference in New Issue
Block a user