def run(self):
global httpd
print('starting server...')
server_address = (self.ip,self.port)
try:
httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
if self.https_allow and self.cert_file:
if os.path.exists(self.cert_file):
httpd.socket = ssl.wrap_socket(
httpd.socket,certfile=self.cert_file,
ssl_version=ssl.PROTOCOL_TLSv1_1)
except:
txt = 'Your local IP changed..or port is blocked\n..Trying to find new IP'
#subprocess.Popen(['notify-send',txt])
send_notification(txt)
self.ip = get_ip()
txt = 'Your New Address is '+self.ip + '\n Please restart the player'
#subprocess.Popen(['notify-send',txt])
send_notification(txt)
change_config_file(self.ip,self.port)
server_address = (self.ip,self.port)
httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
print('running server...at..'+self.ip+':'+str(self.port))
httpd.serve_forever()
评论列表
文章目录