From c24351d58febfcacf5946f5c1e395d016a9b85ef Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Wed, 11 Oct 2006 23:11:54 +0000 Subject: [PATCH] split error for unable to bind to port --- src/common/zeroconf/client_zeroconf.py | 5 +++-- src/common/zeroconf/connection_zeroconf.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py index 30d5c145a..779d0ed57 100644 --- a/src/common/zeroconf/client_zeroconf.py +++ b/src/common/zeroconf/client_zeroconf.py @@ -480,12 +480,13 @@ class ClientZeroconf: def connect(self, show, msg): self.port = self.start_listener(self.caller.port) if not self.port: - return + return False self.zeroconf_init(show, msg) if not self.zeroconf.connect(): self.disconnect() - return + return None self.roster = roster_zeroconf.Roster(self.zeroconf) + return True def remove_announce(self): if self.zeroconf: diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index c75ea4331..318545f96 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -218,11 +218,16 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): _('Please check if Avahi is installed.'))) self.disconnect() return - self.connection.connect(show, msg) - if not self.connection.listener: + result = self.connection.connect(show, msg) + if not result: self.dispatch('STATUS', 'offline') self.status = 'offline' - self.dispatch('CONNECTION_LOST', + if result is False: + self.dispatch('CONNECTION_LOST', + (_('Could not start local service'), + _('Unable to bind to port %d.' % self.port))) + else: # result is None + self.dispatch('CONNECTION_LOST', (_('Could not start local service'), _('Please check if avahi-daemon is running.'))) self.disconnect()