Ignore avahi 'Local name collision' exceptions for now, but this should really get fixed

This commit is contained in:
Dan Williams 2006-06-05 10:47:14 -04:00
parent a0f7a4abc6
commit 93333ed5cf

View File

@ -1,6 +1,6 @@
# -*- 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_REMOVED = 'removed'
@ -92,8 +92,15 @@ class PresenceAnnounce(object):
rs_name = self._hostname
info = ["%s=%s" % (k, v) for k, v in kwargs.items()]
g.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, 0, rs_name, rs_service,
"", "", # domain, host (let the system figure it out)
dbus.UInt16(rs_port), info,)
g.Commit()
try:
g.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, 0, rs_name, rs_service,
"", "", # domain, host (let the system figure it out)
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