1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 00:07:14 +03:00

protocol.py: Add logging to protocol shutdown sequence

# Conflicts:
#	protocol.py
This commit is contained in:
Athanasius 2021-03-22 12:56:02 +00:00
parent d0ee0b1148
commit d5b2f32d18

View File

@ -1,15 +1,19 @@
# edmc: protocol handler for cAPI authorisation
import logging
import threading
import urllib.request, urllib.error, urllib.parse
import sys
from os import getenv
from config import appname, config
from constants import protocolhandler_redirect
from EDMCLogging import get_main_logger
from config import appname, appcmdname
logger = get_main_logger()
if getenv("EDMC_NO_UI"):
logger = logging.getLogger(appcmdname)
else:
logger = logging.getLogger(appname)
if sys.platform == 'win32':
from ctypes import *
@ -237,10 +241,18 @@ else: # Linux / Run from source
def close(self):
thread = self.thread
if thread:
logger.debug('Thread')
self.thread = None
if self.httpd:
logger.info('Shutting down httpd')
self.httpd.shutdown()
thread.join() # Wait for it to quit
logger.info('Joining thread')
thread.join() # Wait for it to quit
else:
logger.debug('No thread')
def worker(self):
self.httpd.serve_forever()