Ignore avahi 'Local name collision' exceptions for now, but this should really get fixed
This commit is contained in:
parent
a0f7a4abc6
commit
93333ed5cf
@ -1,6 +1,6 @@
|
|||||||
# -*- tab-width: 4; indent-tabs-mode: t -*-
|
# -*- tab-width: 4; indent-tabs-mode: t -*-
|
||||||
|
|
||||||
import avahi, dbus, dbus.glib
|
import avahi, dbus, dbus.glib, dbus_bindings
|
||||||
|
|
||||||
ACTION_SERVICE_NEW = 'new'
|
ACTION_SERVICE_NEW = 'new'
|
||||||
ACTION_SERVICE_REMOVED = 'removed'
|
ACTION_SERVICE_REMOVED = 'removed'
|
||||||
@ -92,8 +92,15 @@ class PresenceAnnounce(object):
|
|||||||
rs_name = self._hostname
|
rs_name = self._hostname
|
||||||
|
|
||||||
info = ["%s=%s" % (k, v) for k, v in kwargs.items()]
|
info = ["%s=%s" % (k, v) for k, v in kwargs.items()]
|
||||||
g.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, 0, rs_name, rs_service,
|
try:
|
||||||
"", "", # domain, host (let the system figure it out)
|
g.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, 0, rs_name, rs_service,
|
||||||
dbus.UInt16(rs_port), info,)
|
"", "", # domain, host (let the system figure it out)
|
||||||
g.Commit()
|
dbus.UInt16(rs_port), info,)
|
||||||
|
g.Commit()
|
||||||
|
except dbus_bindings.DBusException, exc:
|
||||||
|
# FIXME: ignore local name collisions, since that means
|
||||||
|
# the zeroconf service is already registered. Ideally we
|
||||||
|
# should un-register it an re-register with the correct info
|
||||||
|
if str(exc) == "Local name collision":
|
||||||
|
pass
|
||||||
return g
|
return g
|
||||||
|
Loading…
Reference in New Issue
Block a user