]> arthur.barton.de Git - netatalk.git/commitdiff
netatalk: refresh Zeroconf registration when receiving SIGHUP
authorRalph Boehme <rb@sernet.de>
Thu, 14 Aug 2014 12:37:04 +0000 (14:37 +0200)
committerRalph Boehme <rb@sernet.de>
Thu, 21 Aug 2014 08:47:45 +0000 (10:47 +0200)
Signed-off-by: Ralph Boehme <rb@sernet.de>
NEWS
etc/netatalk/afp_avahi.c
etc/netatalk/netatalk.c

diff --git a/NEWS b/NEWS
index 3c25c8bac33bd6787194de0c1cebc256d08ba63d..a16a37afcf17af17f50f9213ed18968ce51223fe 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Changes in 3.1.6
 * FIX: Spotlight: fix for long running queries
 * UPD: afpd: distribute SIGHUP from parent afpd to children and force
        reload shares
+* FIX: netatalk: refresh Zeroconf registration when receiving SIGHUP
 
 Changes in 3.1.5
 ================
index 63bc95006768354d0e234af3ec9f30962803c504..d6b55dc8cc3ce859df9a539276ea0289efda2c1f 100644 (file)
@@ -316,16 +316,13 @@ fail:
  * Call this function from inside this thread.
  */
 int av_zeroconf_unregister() {
-    LOG(log_error, logtype_afpd, "av_zeroconf_unregister");
+    LOG(log_debug, logtype_afpd, "av_zeroconf_unregister");
 
     if (ctx) {
-        LOG(log_error, logtype_afpd, "av_zeroconf_unregister: avahi_threaded_poll_stop");
         if (ctx->threaded_poll)
             avahi_threaded_poll_stop(ctx->threaded_poll);
-        LOG(log_error, logtype_afpd, "av_zeroconf_unregister: avahi_client_free");
         if (ctx->client)
             avahi_client_free(ctx->client);
-        LOG(log_error, logtype_afpd, "av_zeroconf_unregister: avahi_threaded_poll_free");
         if (ctx->threaded_poll)
             avahi_threaded_poll_free(ctx->threaded_poll);
         free(ctx);
index bf7e15891df26833e89315222159ce5b7b17d6a9..1956ac58a820734447dfd9b340e5521890acb133 100644 (file)
@@ -194,6 +194,14 @@ static void sigquit_cb(evutil_socket_t fd, short what, void *arg)
 static void sighup_cb(evutil_socket_t fd, short what, void *arg)
 {
     LOG(log_note, logtype_afpd, "Received SIGHUP, sending all processes signal to reload config");
+
+    if (!(obj.options.flags & OPTION_NOZEROCONF)) {
+        zeroconf_deregister();
+        load_volumes(&obj, lv_all | lv_force);
+        zeroconf_register(&obj);
+        LOG(log_note, logtype_default, "Re-registered with Zeroconf");
+    }
+
     kill_childs(SIGHUP, &afpd_pid, &cnid_metad_pid, NULL);
 }
 
@@ -442,9 +450,8 @@ int main(int argc, char **argv)
 
     /* Now register with zeroconf, we also need the volumes for that */
     if (! (obj.options.flags & OPTION_NOZEROCONF)) {
-        LOG(log_note, logtype_default, "Registering with Zeroconf");
         zeroconf_register(&obj);
-        LOG(log_note, logtype_default, "done");
+        LOG(log_note, logtype_default, "Registered with Zeroconf");
     }
 
     /* run the event loop */