Announcing now works at least :)

portnov [2009-02-27 09:10:42]
Announcing now works at least :)
Filename
zeroconf.py
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()
ViewGit