network plugin: Fix shutdown code.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 27 Mar 2007 14:31:22 +0000 (16:31 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 27 Mar 2007 14:31:22 +0000 (16:31 +0200)
src/network.c

index b5d8efb..35ffb39 100644 (file)
@@ -1118,13 +1118,24 @@ static int network_shutdown (void)
 
        listen_loop++;
 
-       pthread_kill (listen_thread, SIGTERM);
-       pthread_join (listen_thread, NULL /* no return value */);
+       if (listen_thread != (pthread_t) 0)
+       {
+               pthread_kill (listen_thread, SIGTERM);
+               pthread_join (listen_thread, NULL /* no return value */);
+               listen_thread = (pthread_t) 0;
+       }
 
        listen_thread = 0;
 
+       /* TODO: Close `sending_sockets' */
+
+       plugin_unregister_config ("network");
+       plugin_unregister_init ("network");
+       plugin_unregister_write ("network");
+       plugin_unregister_shutdown ("network");
+
        return (0);
-}
+} /* int network_shutdown */
 
 static int network_init (void)
 {