Fix Kodi hangup on exit

This commit is contained in:
angelblue05 2019-01-31 07:25:21 -06:00
parent 0e30a28dcb
commit c9d51690df

View file

@ -21,8 +21,6 @@ class WebService(threading.Thread):
''' Run a webservice to trigger playback.
'''
stop_thread = False
def __init__(self):
threading.Thread.__init__(self)
@ -34,7 +32,6 @@ class WebService(threading.Thread):
conn = httplib.HTTPConnection("127.0.0.1:%d" % PORT)
conn.request("QUIT", "/")
conn.getresponse()
self.stop_thread = True
except Exception as error:
pass
@ -71,7 +68,9 @@ class HttpServer(BaseHTTPServer.HTTPServer):
class requestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
#Handler for the GET requests
''' Http request handler. Do not use LOG here,
it will hang requests in Kodi > show information dialog.
'''
def log_message(self, format, *args):
@ -79,6 +78,14 @@ class requestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
'''
pass
def do_QUIT(self):
''' send 200 OK response, and set server.stop to True
'''
self.send_response(200)
self.end_headers()
self.server.stop = True
def get_params(self):
''' Get the params