mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Better error message when failing to start BonJour plugin because IP address could not be determined
This commit is contained in:
parent
84394aee3e
commit
faca264f18
@ -104,7 +104,7 @@ class PluginPool(object):
|
||||
try:
|
||||
plugin.start(self.loop)
|
||||
except Exception:
|
||||
self.loop.log.exception('Failed to start plugin: %s', self.plugin_name(plugin))
|
||||
self.loop.log.exception('Failed to start plugin:', self.plugin_name(plugin))
|
||||
|
||||
def start(self):
|
||||
for w in self.workers:
|
||||
@ -116,7 +116,7 @@ class PluginPool(object):
|
||||
try:
|
||||
w.plugin.stop()
|
||||
except Exception:
|
||||
self.loop.log.exception('Failed to stop plugin: %s', self.plugin_name(w.plugin))
|
||||
self.loop.log.exception('Failed to stop plugin:', self.plugin_name(w.plugin))
|
||||
for w in self.workers:
|
||||
left = wait_till - monotonic()
|
||||
if left > 0:
|
||||
|
@ -42,6 +42,7 @@ class AllIpAddressesGetter(Thread):
|
||||
# print 'slept'
|
||||
_all_ip_addresses = self.get_all_ips()
|
||||
|
||||
|
||||
_ip_address_getter_thread = None
|
||||
|
||||
|
||||
@ -89,6 +90,7 @@ def verify_ipV4_address(ip_address):
|
||||
pass
|
||||
return result
|
||||
|
||||
|
||||
_ext_ip = None
|
||||
|
||||
|
||||
@ -97,7 +99,7 @@ def get_external_ip():
|
||||
if _ext_ip is None:
|
||||
from calibre.utils.ip_routing import get_default_route_src_address
|
||||
try:
|
||||
_ext_ip = get_default_route_src_address()
|
||||
_ext_ip = get_default_route_src_address() or _get_external_ip()
|
||||
except Exception:
|
||||
_ext_ip = _get_external_ip()
|
||||
return _ext_ip
|
||||
@ -138,6 +140,8 @@ def create_service(desc, type, port, properties, add_hostname, use_ip_address=No
|
||||
local_ip = use_ip_address
|
||||
else:
|
||||
local_ip = get_external_ip()
|
||||
if not local_ip:
|
||||
raise ValueError('Failed to determine local IP address to advertise via BonJour')
|
||||
type = type+'.local.'
|
||||
from calibre.utils.Zeroconf import ServiceInfo
|
||||
return ServiceInfo(type, desc+'.'+type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user