Check whether we actually have a httpd running when unloading rest_api.py
This commit is contained in:
parent
476e4cc9c1
commit
281923a463
1 changed files with 3 additions and 1 deletions
|
@ -92,6 +92,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
global _log
|
global _log
|
||||||
_log = self.log
|
_log = self.log
|
||||||
|
|
||||||
|
self.httpd = None
|
||||||
if self.bot.get_setting("rest-api", False):
|
if self.bot.get_setting("rest-api", False):
|
||||||
self.httpd = http.server.HTTPServer(("", 5000), Handler)
|
self.httpd = http.server.HTTPServer(("", 5000), Handler)
|
||||||
self.httpd.socket = ssl.wrap_socket(self.httpd.socket,
|
self.httpd.socket = ssl.wrap_socket(self.httpd.socket,
|
||||||
|
@ -103,7 +104,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
||||||
def unload(self):
|
def unload(self):
|
||||||
self.httpd.shutdown()
|
if self.httpd:
|
||||||
|
self.httpd.shutdown()
|
||||||
|
|
||||||
@utils.hook("received.command.apikey", private_only=True)
|
@utils.hook("received.command.apikey", private_only=True)
|
||||||
def api_key(self, event):
|
def api_key(self, event):
|
||||||
|
|
Loading…
Reference in a new issue