mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-02 16:41:04 +03:00
protocol.py: Add logging to protocol shutdown sequence
# Conflicts: # protocol.py
This commit is contained in:
parent
d0ee0b1148
commit
d5b2f32d18
22
protocol.py
22
protocol.py
@ -1,15 +1,19 @@
|
|||||||
# edmc: protocol handler for cAPI authorisation
|
# edmc: protocol handler for cAPI authorisation
|
||||||
|
|
||||||
|
|
||||||
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import urllib.request, urllib.error, urllib.parse
|
import urllib.request, urllib.error, urllib.parse
|
||||||
import sys
|
import sys
|
||||||
|
from os import getenv
|
||||||
|
|
||||||
from config import appname, config
|
from config import appname, appcmdname
|
||||||
from constants import protocolhandler_redirect
|
|
||||||
from EDMCLogging import get_main_logger
|
|
||||||
|
|
||||||
logger = get_main_logger()
|
if getenv("EDMC_NO_UI"):
|
||||||
|
logger = logging.getLogger(appcmdname)
|
||||||
|
|
||||||
|
else:
|
||||||
|
logger = logging.getLogger(appname)
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
from ctypes import *
|
from ctypes import *
|
||||||
@ -237,10 +241,18 @@ else: # Linux / Run from source
|
|||||||
def close(self):
|
def close(self):
|
||||||
thread = self.thread
|
thread = self.thread
|
||||||
if thread:
|
if thread:
|
||||||
|
logger.debug('Thread')
|
||||||
self.thread = None
|
self.thread = None
|
||||||
|
|
||||||
if self.httpd:
|
if self.httpd:
|
||||||
|
logger.info('Shutting down httpd')
|
||||||
self.httpd.shutdown()
|
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):
|
def worker(self):
|
||||||
self.httpd.serve_forever()
|
self.httpd.serve_forever()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user