Merge branch 'zeroconf-startup-crash' into 'master'

Zeroconf startup crash

See merge request openlp/openlp!423
This commit is contained in:
Raoul Snyman 2022-02-21 21:37:26 +00:00
commit 9d598773ef

View File

@ -79,8 +79,9 @@ class ZeroconfWorker(ThreadWorker):
addresses=addresses, port=self.http_port, properties={}) addresses=addresses, port=self.http_port, properties={})
ws_info = ServiceInfo('_ws._tcp.local.', 'OpenLP._ws._tcp.local.', ws_info = ServiceInfo('_ws._tcp.local.', 'OpenLP._ws._tcp.local.',
addresses=addresses, port=self.ws_port, properties={}) addresses=addresses, port=self.ws_port, properties={})
zc = Zeroconf() zc = None
try: try:
zc = Zeroconf()
zc.register_service(http_info) zc.register_service(http_info)
zc.register_service(ws_info) zc.register_service(ws_info)
self._can_run = True self._can_run = True
@ -88,9 +89,12 @@ class ZeroconfWorker(ThreadWorker):
sleep(0.1) sleep(0.1)
except Error as e: except Error as e:
self.error.emit('Cannot start Zeroconf service', _get_error_message(e)) self.error.emit('Cannot start Zeroconf service', _get_error_message(e))
except OSError as e:
self.error.emit('Cannot start Zeroconf service', str(e))
finally: finally:
zc.unregister_all_services() if zc is not None:
zc.close() zc.unregister_all_services()
zc.close()
self.quit.emit() self.quit.emit()
def stop(self): def stop(self):