Hi, I'm applying a similar approach and I have no problems. My code:
try: path_to_browser = self.server.ServiceBrowserNew(interface, protocol, stype, domain, dbus.UInt32(0)) proxy = self.bus.get_object(bus_name = avahi.DBUS_NAME, object_path = path_to_browser) ifc = dbus.Interface(proxy, avahi.DBUS_INTERFACE_SERVICE_BROWSER) except DBusException as e: self.stop(error = "Error with the Avahi daemon. Is it still running? " + "Error : %s." % e) return ifc.connect_to_signal('ItemNew', self.newService) ifc.connect_to_signal('ItemRemove', self.removeService) does not suffer of race conditions problems. I've been testing it on networks with hundreds of services and I apply such a scheme several times (creating a ServiceBrowser, creating a new ServiceResolver, creating a new RecordBrowser and so on) without ever having any problem. ----- Mail original ----- De: "Danny Smit" <danny.smi...@gmail.com> À: avahi@lists.freedesktop.org Envoyé: Mardi 23 Décembre 2014 16:22:29 Objet: [avahi] Race condition using the avahi D-Bus interface? Hi everyone, I'm running into a problem with avahi which looks similar to the following reported issue: http://avahi.org/ticket/247 However in this case I'm using c++ / Qt to connect to the avahi daemon. This basically exists out of two steps: 1. Create a ServiceBrowser using the D-Bus API ServiceBrowserNew 2. Connect to the ItemNew signal of the created ServiceBrowser It seems that at step 1 the browser immediately start resolving services and that it may occur that the ItemNew signal is emitted even before step 2 is finished. The way the avahi ServiceBrowser is designed, there is no way to influence this. From my point of view it looks like this design is prone to race conditions. My question is, how is this supposed to work? Should I use the avahi interface differently? Or is this a bug in the design of the avahi ServiceBrowser D-Bus interface? Any help would be greatly appreciated. Kind regards, Danny _______________________________________________ avahi mailing list avahi@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/avahi _______________________________________________ avahi mailing list avahi@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/avahi