From df5593cab315d970956eb9e5767146a01cdbf061 Mon Sep 17 00:00:00 2001 From: portnov Date: Fri, 27 Feb 2009 14:10:42 +0500 Subject: [PATCH] Announcing now works at least :) --- zeroconf.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/zeroconf.py b/zeroconf.py index 9cc2647..3c23033 100644 --- a/zeroconf.py +++ b/zeroconf.py @@ -37,7 +37,7 @@ class ZeroconfThread(threading.Thread): self.master = (mode == 'Master') # TODO: if this server is not Master, detect Master (via zeroconf or from config) and announce it in TXT record self.txt = '' - self.hostname = socket.gethostname() + self.hostname = socket.gethostname() + '.local' self.types = args self.done = {} for type in args: @@ -72,10 +72,11 @@ class ZeroconfThread(threading.Thread): self.group = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.EntryGroupNew()), avahi.DBUS_INTERFACE_ENTRY_GROUP) # self.group.connect_to_signal('StateChanged', self._entry_group_state_changed) + print "Hostname:", self.hostname self.group.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, 0, self.name, self._service_type(), 'local', self.hostname, dbus.UInt16(self.port), - avahi.string_array_to_txt_array(self.txt)) + []) self.group.Commit() @@ -112,8 +113,8 @@ class ZeroconfThread(threading.Thread): return False def run(self): - self._avahi_connect() DBusGMainLoop(set_as_default=True) + self._avahi_connect() if self.timeout: gobject.timeout_add(self.timeout,self.quit) self.announce() @@ -126,6 +127,7 @@ class ZeroconfListener(object): def new_service(self, iface,proto,name,stype,domain, host, aproto,addr, port, txt,flags): global services global hosts + print "Host:", host if stype == '_workstation._tcp': host = machines.Host() -- 1.7.2.3