]> git.meshlink.io Git - catta/commitdiff
Fix no network interface bug reported by Lathiat
authorLennart Poettering <lennart@poettering.net>
Sun, 14 Aug 2005 03:13:28 +0000 (03:13 +0000)
committerLennart Poettering <lennart@poettering.net>
Sun, 14 Aug 2005 03:13:28 +0000 (03:13 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@316 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-core/server.c
avahi-daemon/main.c

index 40ef6166d8d911006b4aad2748aafc826033660a..396dcf45c7cc69a18d0c8619779e205f7917c124 100644 (file)
@@ -1202,10 +1202,14 @@ static void register_stuff(AvahiServer *s) {
     assert(s);
 
     server_set_state(s, AVAHI_SERVER_REGISTERING);
+    s->n_host_rr_pending ++;  /** Make sure that the state isn't changed tp AVAHI_SERVER_RUNNING too early */
+
     register_hinfo(s);
     register_browse_domain(s);
     avahi_update_host_rrs(s->monitor, 0);
 
+    s->n_host_rr_pending --;
+    
     if (s->n_host_rr_pending == 0)
         server_set_state(s, AVAHI_SERVER_RUNNING);
 }
index 843ee2b899f58870565f8c377aeee965de05ffe9..e9030aae713dd049b846d6a8fdd4065d1d0a991d 100644 (file)
@@ -193,6 +193,11 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void *userda
     g_assert(s);
     g_assert(c);
 
+    /** This function is possibly called before the global variable
+     * avahi_server has been set, therefore we do it explicitly */
+
+    avahi_server = s;
+    
 #ifdef ENABLE_DBUS
     if (c->enable_dbus)
         dbus_protocol_server_state_changed(state);
@@ -624,14 +629,14 @@ static gint run_server(DaemonConfig *c) {
             goto finish;
 #endif
     
+    load_resolv_conf(c);
+    static_service_load();
+
     if (!(avahi_server = avahi_server_new(avahi_glib_poll_get(poll_api), &c->server_config, server_callback, c, &error))) {
         avahi_log_error("Failed to create server: %s", avahi_strerror(error));
         goto finish;
     }
 
-    load_resolv_conf(c);
-    
-    static_service_load();
 
     if (c->daemonize)
         daemon_retval_send(0);
@@ -968,7 +973,7 @@ int main(int argc, char *argv[]) {
 
         chdir("/");
         
-        avahi_log_info("%s "PACKAGE_VERSION" starting up.\n", argv0);
+        avahi_log_info("%s "PACKAGE_VERSION" starting up.", argv0);
         
         if (run_server(&config) == 0)
             r = 0;