split error for unable to bind to port

This commit is contained in:
Dimitur Kirov 2006-10-11 23:11:54 +00:00
parent 6621657ccc
commit c24351d58f
2 changed files with 11 additions and 5 deletions

View File

@ -480,12 +480,13 @@ class ClientZeroconf:
def connect(self, show, msg): def connect(self, show, msg):
self.port = self.start_listener(self.caller.port) self.port = self.start_listener(self.caller.port)
if not self.port: if not self.port:
return return False
self.zeroconf_init(show, msg) self.zeroconf_init(show, msg)
if not self.zeroconf.connect(): if not self.zeroconf.connect():
self.disconnect() self.disconnect()
return return None
self.roster = roster_zeroconf.Roster(self.zeroconf) self.roster = roster_zeroconf.Roster(self.zeroconf)
return True
def remove_announce(self): def remove_announce(self):
if self.zeroconf: if self.zeroconf:

View File

@ -218,11 +218,16 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
_('Please check if Avahi is installed.'))) _('Please check if Avahi is installed.')))
self.disconnect() self.disconnect()
return return
self.connection.connect(show, msg) result = self.connection.connect(show, msg)
if not self.connection.listener: if not result:
self.dispatch('STATUS', 'offline') self.dispatch('STATUS', 'offline')
self.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'), (_('Could not start local service'),
_('Please check if avahi-daemon is running.'))) _('Please check if avahi-daemon is running.')))
self.disconnect() self.disconnect()