diff --git a/src/calibre/srv/pool.py b/src/calibre/srv/pool.py index f8bcaca019..dd0fa8978e 100644 --- a/src/calibre/srv/pool.py +++ b/src/calibre/srv/pool.py @@ -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: diff --git a/src/calibre/utils/mdns.py b/src/calibre/utils/mdns.py index bfc579d89d..294253ae7f 100644 --- a/src/calibre/utils/mdns.py +++ b/src/calibre/utils/mdns.py @@ -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,