mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
Add telnet server
This commit is contained in:
+8
-2
@@ -5,12 +5,13 @@ import signal
|
||||
import sys
|
||||
|
||||
from core.cleanup import CLEANUP_TIMER
|
||||
from core.config import LOG_LEVEL, SERVER_OWNER_CALLSIGN
|
||||
from core.config import LOG_LEVEL, SERVER_OWNER_CALLSIGN, TELNET_SERVER_ENABLED, TELNET_SERVER_PORT
|
||||
from core.constants import SOFTWARE_VERSION
|
||||
from core.data_providers import DATA_PROVIDERS
|
||||
from core.data_store import DATA_STORE
|
||||
from core.status_reporter import StatusReporter
|
||||
from server.webserver import WEB_SERVER
|
||||
from telnetserver.telnetserver import TELNET_SERVER
|
||||
from webserver.webserver import WEB_SERVER
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -20,6 +21,7 @@ def shutdown(_signum=None, _frame=None):
|
||||
|
||||
logger.info("Stopping program...")
|
||||
WEB_SERVER.stop()
|
||||
TELNET_SERVER.stop()
|
||||
DATA_PROVIDERS.stop()
|
||||
CLEANUP_TIMER.stop()
|
||||
DATA_STORE.close()
|
||||
@@ -60,6 +62,10 @@ if __name__ == "__main__":
|
||||
# Set up the web server
|
||||
WEB_SERVER.setup()
|
||||
|
||||
# Run the telnet server
|
||||
if TELNET_SERVER_ENABLED:
|
||||
TELNET_SERVER.start(port=TELNET_SERVER_PORT)
|
||||
|
||||
# Run the web server. This is the blocking call that keeps the application running in the main thread, so this must
|
||||
# be the last thing we do. web_server.stop() triggers an await condition in the web server which finishes the main
|
||||
# thread.
|
||||
|
||||
Reference in New Issue
Block a user