gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r27074 - in gnunet/src: dns exit fs include testbed transpo


From: gnunet
Subject: [GNUnet-SVN] r27074 - in gnunet/src: dns exit fs include testbed transport util vpn
Date: Thu, 9 May 2013 11:45:54 +0200

Author: harsha
Date: 2013-05-09 11:45:53 +0200 (Thu, 09 May 2013)
New Revision: 27074

Modified:
   gnunet/src/dns/gnunet-service-dns.c
   gnunet/src/exit/gnunet-daemon-exit.c
   gnunet/src/fs/fs_dirmetascan.c
   gnunet/src/include/gnunet_helper_lib.h
   gnunet/src/testbed/gnunet-service-testbed.c
   gnunet/src/testbed/gnunet-service-testbed_links.c
   gnunet/src/testbed/test_gnunet_helper_testbed.c
   gnunet/src/testbed/testbed_api_hosts.c
   gnunet/src/testbed/testbed_api_hosts.h
   gnunet/src/transport/plugin_transport_wlan.c
   gnunet/src/transport/test_plugin_transport.c
   gnunet/src/util/helper.c
   gnunet/src/vpn/gnunet-service-vpn.c
Log:
- complement HELPER API with functions to kill and wait on the helper process

- To shutdown quickly, have testbed first kill all sub-controller's helper
  processes first and wait later instead of kill & wait per each processes.


Modified: gnunet/src/dns/gnunet-service-dns.c
===================================================================
--- gnunet/src/dns/gnunet-service-dns.c 2013-05-08 16:53:16 UTC (rev 27073)
+++ gnunet/src/dns/gnunet-service-dns.c 2013-05-09 09:45:53 UTC (rev 27074)
@@ -281,7 +281,7 @@
 {
   unsigned int i;
 
-  GNUNET_HELPER_stop (hijacker);
+  GNUNET_HELPER_stop (hijacker, GNUNET_NO);
   hijacker = NULL;
   for (i=0;i<7;i++)
     GNUNET_free_non_null (helper_argv[i]);

Modified: gnunet/src/exit/gnunet-daemon-exit.c
===================================================================
--- gnunet/src/exit/gnunet-daemon-exit.c        2013-05-08 16:53:16 UTC (rev 
27073)
+++ gnunet/src/exit/gnunet-daemon-exit.c        2013-05-09 09:45:53 UTC (rev 
27074)
@@ -3074,7 +3074,7 @@
 
   if (helper_handle != NULL)
   {
-    GNUNET_HELPER_stop (helper_handle);
+    GNUNET_HELPER_stop (helper_handle, GNUNET_NO);
     helper_handle = NULL;
   }
   if (mesh_handle != NULL)

Modified: gnunet/src/fs/fs_dirmetascan.c
===================================================================
--- gnunet/src/fs/fs_dirmetascan.c      2013-05-08 16:53:16 UTC (rev 27073)
+++ gnunet/src/fs/fs_dirmetascan.c      2013-05-09 09:45:53 UTC (rev 27074)
@@ -102,7 +102,7 @@
 {
   /* terminate helper */
   if (NULL != ds->helper)
-    GNUNET_HELPER_stop (ds->helper);
+    GNUNET_HELPER_stop (ds->helper, GNUNET_NO);
   
   /* free resources */
   if (NULL != ds->toplevel)
@@ -234,7 +234,7 @@
   ds->stop_task = GNUNET_SCHEDULER_NO_TASK;
   if (NULL != ds->helper)
   {
-    GNUNET_HELPER_stop (ds->helper);
+    GNUNET_HELPER_stop (ds->helper, GNUNET_NO);
     ds->helper = NULL;
   }
   ds->progress_callback (ds->progress_callback_cls, 

Modified: gnunet/src/include/gnunet_helper_lib.h
===================================================================
--- gnunet/src/include/gnunet_helper_lib.h      2013-05-08 16:53:16 UTC (rev 
27073)
+++ gnunet/src/include/gnunet_helper_lib.h      2013-05-09 09:45:53 UTC (rev 
27074)
@@ -20,7 +20,8 @@
 
 /**
  * @file include/gnunet_helper_lib.h
- * @brief API for dealing with (SUID) helper processes that communicate via 
GNUNET_MessageHeaders on stdin/stdout
+ * @brief API for dealing with (SUID) helper processes that communicate via
+ *          GNUNET_MessageHeaders on stdin/stdout
  * @author Philipp Toelke
  * @author Christian Grothoff
  */
@@ -72,22 +73,49 @@
 
 
 /**
- * Kills the helper, closes the pipe and frees the handle
+ * Sends termination signal to the helper process.  The helper process is not
+ * reaped; call GNUNET_HELPER_wait() for reaping the dead helper process.
  *
- * @param h handle to helper to stop
+ * @param h the helper handle
+ * @param soft_kill if GNUNET_YES, signals termination by closing the helper's
+ *          stdin; GNUNET_NO to signal termination by sending SIGTERM to helper
+ * @return GNUNET_OK on success; GNUNET_SYSERR on error
  */
+int
+GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, int soft_kill);
+
+
+/**
+ * Reap the helper process.  This call is blocking(!).  The helper process
+ * should either be sent a termination signal before or should be dead before
+ * calling this function
+ *
+ * @param h the helper handle
+ * @return GNUNET_OK on success; GNUNET_SYSERR on error
+ */
+int
+GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h);
+
+
+/**
+ * Free's the resources occupied by the helper handle
+ *
+ * @param h the helper handle to free
+ */
 void
-GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h);
+GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h);
 
 
 /**
- * Kills the helper by closing its stdin (the helper is expected to catch the
- * resulting SIGPIPE and shutdown), closes the pipe and frees the handle
+ * Kills the helper, closes the pipe, frees the handle and calls wait() on the
+ * helper process
  *
  * @param h handle to helper to stop
+ * @param soft_kill if GNUNET_YES, signals termination by closing the helper's
+ *          stdin; GNUNET_NO to signal termination by sending SIGTERM to helper
  */
 void
-GNUNET_HELPER_soft_stop (struct GNUNET_HELPER_Handle *h);
+GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill);
 
 
 /**

Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2013-05-08 16:53:16 UTC (rev 
27073)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2013-05-09 09:45:53 UTC (rev 
27074)
@@ -785,7 +785,7 @@
   uint32_t id;
 
   shutdown_task_id = GNUNET_SCHEDULER_NO_TASK;
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down testbed service\n");
+  LOG_DEBUG ("Shutting down testbed service\n");
   /* cleanup any remaining forwarded operations */
   GST_clear_fopcq ();
   GST_free_lcfq ();
@@ -904,6 +904,7 @@
   char *logfile;
   unsigned long long num;
 
+  LOG_DEBUG ("Starting testbed\n");
   if (GNUNET_OK ==
       GNUNET_CONFIGURATION_get_value_filename (cfg, "TESTBED", "LOG_FILE",
                                                &logfile))

Modified: gnunet/src/testbed/gnunet-service-testbed_links.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_links.c   2013-05-08 16:53:16 UTC 
(rev 27073)
+++ gnunet/src/testbed/gnunet-service-testbed_links.c   2013-05-09 09:45:53 UTC 
(rev 27074)
@@ -425,32 +425,47 @@
 void
 GST_slave_list_clear ()
 {
+  struct HostRegistration *hr_entry;
+  struct GNUNET_TESTBED_ControllerProc *cproc;
   unsigned int id;
-  struct HostRegistration *hr_entry;
 
   for (id = 0; id < GST_slave_list_size; id++)
-    if (NULL != GST_slave_list[id])
+  {
+    if (NULL == GST_slave_list[id])
+      continue;
+    while (NULL != (hr_entry = GST_slave_list[id]->hr_dll_head))
     {
-      while (NULL != (hr_entry = GST_slave_list[id]->hr_dll_head))
-      {
-        GNUNET_CONTAINER_DLL_remove (GST_slave_list[id]->hr_dll_head,
-                                     GST_slave_list[id]->hr_dll_tail, 
hr_entry);
-        GNUNET_free (hr_entry);
-      }
-      if (NULL != GST_slave_list[id]->rhandle)
-        GNUNET_TESTBED_cancel_registration (GST_slave_list[id]->rhandle);
-      (void)
-          GNUNET_CONTAINER_multihashmap_iterate (GST_slave_list
-                                                 [id]->reghost_map,
-                                                 reghost_free_iterator,
-                                                 GST_slave_list[id]);
-      GNUNET_CONTAINER_multihashmap_destroy (GST_slave_list[id]->reghost_map);
-      if (NULL != GST_slave_list[id]->controller)
-        GNUNET_TESTBED_controller_disconnect (GST_slave_list[id]->controller);
-      if (NULL != GST_slave_list[id]->controller_proc)
-        GNUNET_TESTBED_controller_stop (GST_slave_list[id]->controller_proc);
-      GNUNET_free (GST_slave_list[id]);
+      GNUNET_CONTAINER_DLL_remove (GST_slave_list[id]->hr_dll_head,
+                                   GST_slave_list[id]->hr_dll_tail, hr_entry);
+      GNUNET_free (hr_entry);
     }
+    if (NULL != GST_slave_list[id]->rhandle)
+      GNUNET_TESTBED_cancel_registration (GST_slave_list[id]->rhandle);
+    (void)
+        GNUNET_CONTAINER_multihashmap_iterate (GST_slave_list
+                                               [id]->reghost_map,
+                                               reghost_free_iterator,
+                                               GST_slave_list[id]);
+    GNUNET_CONTAINER_multihashmap_destroy (GST_slave_list[id]->reghost_map);
+    if (NULL != GST_slave_list[id]->controller)
+      GNUNET_TESTBED_controller_disconnect (GST_slave_list[id]->controller);
+    if (NULL != (cproc = GST_slave_list[id]->controller_proc))
+    {
+      LOG_DEBUG ("Stopping a slave\n");
+      GNUNET_TESTBED_controller_kill_ (cproc);
+    }
+  }
+  for (id = 0; id < GST_slave_list_size; id++)
+  {
+    if (NULL == GST_slave_list[id])
+      continue;
+    if (NULL != (cproc = GST_slave_list[id]->controller_proc))
+    {
+      GNUNET_TESTBED_controller_destroy_ (cproc);
+      LOG_DEBUG ("Slave stopped\n");
+    }
+    GNUNET_free (GST_slave_list[id]);
+  }
   GNUNET_free_non_null (GST_slave_list);
   GST_slave_list = NULL;
 }

Modified: gnunet/src/testbed/test_gnunet_helper_testbed.c
===================================================================
--- gnunet/src/testbed/test_gnunet_helper_testbed.c     2013-05-08 16:53:16 UTC 
(rev 27073)
+++ gnunet/src/testbed/test_gnunet_helper_testbed.c     2013-05-09 09:45:53 UTC 
(rev 27074)
@@ -88,7 +88,7 @@
   if (GNUNET_SCHEDULER_NO_TASK != abort_task)
     GNUNET_SCHEDULER_cancel (abort_task);
   if (NULL != helper)
-    GNUNET_HELPER_stop (helper);
+    GNUNET_HELPER_stop (helper, GNUNET_NO);
   GNUNET_free_non_null (msg);
   if (NULL != cfg)
     GNUNET_CONFIGURATION_destroy (cfg);

Modified: gnunet/src/testbed/testbed_api_hosts.c
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.c      2013-05-08 16:53:16 UTC (rev 
27073)
+++ gnunet/src/testbed/testbed_api_hosts.c      2013-05-09 09:45:53 UTC (rev 
27074)
@@ -1261,20 +1261,33 @@
 
 
 /**
- * Stop the controller process (also will terminate all peers and controllers
- * dependent on this controller).  This function blocks until the testbed has
- * been fully terminated (!). The controller status cb from
- * GNUNET_TESTBED_controller_start() will not be called.
+ * Sends termination signal to the controller's helper process
  *
- * @param cproc the controller process handle
+ * @param cproc the handle to the controller's helper process
  */
 void
-GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_ControllerProc *cproc)
+GNUNET_TESTBED_controller_kill_ (struct GNUNET_TESTBED_ControllerProc *cproc)
 {
   if (NULL != cproc->shandle)
     GNUNET_HELPER_send_cancel (cproc->shandle);
   if (NULL != cproc->helper)
-    GNUNET_HELPER_soft_stop (cproc->helper);
+    GNUNET_HELPER_kill (cproc->helper, GNUNET_YES);
+}
+
+
+/**
+ * Cleans-up the controller's helper process handle
+ *
+ * @param cproc the handle to the controller's helper process
+ */
+void
+GNUNET_TESTBED_controller_destroy_ (struct GNUNET_TESTBED_ControllerProc 
*cproc)
+{
+  if (NULL != cproc->helper)
+  {
+    GNUNET_break (GNUNET_OK == GNUNET_HELPER_wait (cproc->helper));
+    GNUNET_HELPER_destroy (cproc->helper);
+  }
   if (NULL != cproc->helper_argv)
     free_argv (cproc->helper_argv);
   cproc->host->controller_started = GNUNET_NO;
@@ -1284,6 +1297,22 @@
 
 
 /**
+ * Stop the controller process (also will terminate all peers and controllers
+ * dependent on this controller).  This function blocks until the testbed has
+ * been fully terminated (!). The controller status cb from
+ * GNUNET_TESTBED_controller_start() will not be called.
+ *
+ * @param cproc the controller process handle
+ */
+void
+GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_ControllerProc *cproc)
+{
+  GNUNET_TESTBED_controller_kill_ (cproc);
+  GNUNET_TESTBED_controller_destroy_ (cproc);
+}
+
+
+/**
  * The handle for whether a host is habitable or not
  */
 struct GNUNET_TESTBED_HostHabitableCheckHandle

Modified: gnunet/src/testbed/testbed_api_hosts.h
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.h      2013-05-08 16:53:16 UTC (rev 
27073)
+++ gnunet/src/testbed/testbed_api_hosts.h      2013-05-09 09:45:53 UTC (rev 
27074)
@@ -233,5 +233,25 @@
                                             GNUNET_TESTBED_HostConfirmedMessage
                                             *msg);
 
+
+/**
+ * Sends termination signal to the controller's helper process
+ *
+ * @param cproc the handle to the controller's helper process
+ */
+void
+GNUNET_TESTBED_controller_kill_ (struct GNUNET_TESTBED_ControllerProc *cproc);
+
+
+/**
+ * Cleans-up the controller's helper process handle
+ *
+ * @param cproc the handle to the controller's helper process
+ */
+void
+GNUNET_TESTBED_controller_destroy_ (struct GNUNET_TESTBED_ControllerProc
+                                    *cproc);
+
+
 #endif
 /* end of testbed_api_hosts.h */

Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c        2013-05-08 16:53:16 UTC 
(rev 27073)
+++ gnunet/src/transport/plugin_transport_wlan.c        2013-05-09 09:45:53 UTC 
(rev 27074)
@@ -1613,7 +1613,7 @@
   }
   if (NULL != plugin->suid_helper)
   {
-    GNUNET_HELPER_stop (plugin->suid_helper);
+    GNUNET_HELPER_stop (plugin->suid_helper, GNUNET_NO);
     plugin->suid_helper = NULL;
   }
   endpoint_next = plugin->mac_head;

Modified: gnunet/src/transport/test_plugin_transport.c
===================================================================
--- gnunet/src/transport/test_plugin_transport.c        2013-05-08 16:53:16 UTC 
(rev 27073)
+++ gnunet/src/transport/test_plugin_transport.c        2013-05-09 09:45:53 UTC 
(rev 27074)
@@ -186,7 +186,7 @@
 
   if (NULL != suid_helper)
   {
-    GNUNET_HELPER_stop (suid_helper);
+    GNUNET_HELPER_stop (suid_helper, GNUNET_NO);
     suid_helper = NULL;
   }
 }
@@ -252,7 +252,7 @@
 
   if (NULL != suid_helper)
   {
-    GNUNET_HELPER_stop (suid_helper);
+    GNUNET_HELPER_stop (suid_helper, GNUNET_NO);
     suid_helper = NULL;
   }
 

Modified: gnunet/src/util/helper.c
===================================================================
--- gnunet/src/util/helper.c    2013-05-08 16:53:16 UTC (rev 27073)
+++ gnunet/src/util/helper.c    2013-05-09 09:45:53 UTC (rev 27074)
@@ -20,7 +20,8 @@
 
 /**
  * @file util/helper.c
- * @brief API for dealing with (SUID) helper processes that communicate via 
GNUNET_MessageHeaders on stdin/stdout
+ * @brief API for dealing with (SUID) helper processes that communicate via
+ *          GNUNET_MessageHeaders on stdin/stdout
  * @author Philipp Toelke
  * @author Christian Grothoff
  */
@@ -162,38 +163,71 @@
 
 
 /**
- * Stop the helper process, we're closing down or had an error.
+ * Sends termination signal to the helper process.  The helper process is not
+ * reaped; call GNUNET_HELPER_wait() for reaping the dead helper process.
  *
- * @param h handle to the helper process
+ * @param h the helper handle
  * @param soft_kill if GNUNET_YES, signals termination by closing the helper's
  *          stdin; GNUNET_NO to signal termination by sending SIGTERM to helper
+ * @return GNUNET_OK on success; GNUNET_SYSERR on error
  */
-static void
-stop_helper (struct GNUNET_HELPER_Handle *h, int soft_kill)
+int
+GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, int soft_kill)
 {
   struct GNUNET_HELPER_SendHandle *sh;
+  int ret;
 
-  if (NULL != h->helper_proc)
+  while (NULL != (sh = h->sh_head))
   {
-    if (GNUNET_YES == soft_kill)
-    { 
-      /* soft-kill only possible with pipes */
-      GNUNET_assert (NULL != h->helper_in);
-      GNUNET_DISK_pipe_close (h->helper_in);
-      h->helper_in = NULL;
-      h->fh_to_helper = NULL;
-    }
-    else
-      GNUNET_break (0 == GNUNET_OS_process_kill (h->helper_proc, SIGTERM));
-    GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (h->helper_proc));
-    GNUNET_OS_process_destroy (h->helper_proc);
-    h->helper_proc = NULL;
+    GNUNET_CONTAINER_DLL_remove (h->sh_head,
+                                h->sh_tail,
+                                sh);
+    if (NULL != sh->cont)
+      sh->cont (sh->cont_cls, GNUNET_NO);
+    GNUNET_free (sh);
   }
   if (GNUNET_SCHEDULER_NO_TASK != h->restart_task)
   {
     GNUNET_SCHEDULER_cancel (h->restart_task);
     h->restart_task = GNUNET_SCHEDULER_NO_TASK;
   }
+  if (NULL == h->helper_proc)
+    return GNUNET_SYSERR;
+  if (GNUNET_YES == soft_kill)
+  { 
+    /* soft-kill only possible with pipes */
+    GNUNET_assert (NULL != h->helper_in);
+    ret = GNUNET_DISK_pipe_close (h->helper_in);
+    h->helper_in = NULL;
+    h->fh_to_helper = NULL;
+    return ret;
+  }
+  if (0 != GNUNET_OS_process_kill (h->helper_proc, SIGTERM))
+    return GNUNET_SYSERR;
+  return GNUNET_OK;
+}
+
+
+/**
+ * Reap the helper process.  This call is blocking(!).  The helper process
+ * should either be sent a termination signal before or should be dead before
+ * calling this function
+ *
+ * @param h the helper handle
+ * @return GNUNET_OK on success; GNUNET_SYSERR on error
+ */
+int
+GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h)
+{
+  struct GNUNET_HELPER_SendHandle *sh;
+  int ret;
+
+  if (NULL != h->helper_proc)
+  {
+    ret = GNUNET_OS_process_wait (h->helper_proc);
+    GNUNET_OS_process_destroy (h->helper_proc);
+    h->helper_proc = NULL;
+  }
   if (GNUNET_SCHEDULER_NO_TASK != h->read_task)
   {
     GNUNET_SCHEDULER_cancel (h->read_task);
@@ -227,10 +261,26 @@
   }
   /* purge MST buffer */
   (void) GNUNET_SERVER_mst_receive (h->mst, NULL, NULL, 0, GNUNET_YES, 
GNUNET_NO);
+  return ret;
 }
 
 
 /**
+ * Stop the helper process, we're closing down or had an error.
+ *
+ * @param h handle to the helper process
+ * @param soft_kill if GNUNET_YES, signals termination by closing the helper's
+ *          stdin; GNUNET_NO to signal termination by sending SIGTERM to helper
+ */
+static void
+stop_helper (struct GNUNET_HELPER_Handle *h, int soft_kill)
+{
+  GNUNET_break (GNUNET_OK == GNUNET_HELPER_kill (h, soft_kill));
+  GNUNET_break (GNUNET_OK == GNUNET_HELPER_wait (h));
+}
+
+
+/**
  * Restart the helper process.
  *
  * @param cls handle to the helper process
@@ -274,7 +324,7 @@
     if (NULL != h->exp_cb)
     {
       h->exp_cb (h->cb_cls);
-      GNUNET_HELPER_stop (h);
+      GNUNET_HELPER_stop (h, GNUNET_NO);
       return;
     }
     stop_helper (h, GNUNET_NO);
@@ -293,7 +343,7 @@
     if (NULL != h->exp_cb)
     {
       h->exp_cb (h->cb_cls);
-      GNUNET_HELPER_stop (h);
+      GNUNET_HELPER_stop (h, GNUNET_NO);
       return;
     }
     stop_helper (h, GNUNET_NO);
@@ -318,7 +368,7 @@
     if (NULL != h->exp_cb)
     {
       h->exp_cb (h->cb_cls);
-      GNUNET_HELPER_stop (h);
+      GNUNET_HELPER_stop (h, GNUNET_NO);
       return;
     }     
     stop_helper (h, GNUNET_NO);
@@ -445,30 +495,15 @@
 
 
 /**
- * @brief Kills the helper, closes the pipe and frees the h
+ * Free's the resources occupied by the helper handle
  *
- * @param h h to helper to stop
- * @param soft_kill if GNUNET_YES, signals termination by closing the helper's
- *          stdin; GNUNET_NO to signal termination by sending SIGTERM to helper
+ * @param h the helper handle to free
  */
-static void
-kill_helper (struct GNUNET_HELPER_Handle *h, int soft_kill)
+void
+GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h)
 {
-  struct GNUNET_HELPER_SendHandle *sh;
   unsigned int c;
 
-  h->exp_cb = NULL;
-  /* signal pending writes that we were stopped */
-  while (NULL != (sh = h->sh_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (h->sh_head,
-                                h->sh_tail,
-                                sh);
-    if (NULL != sh->cont)
-      sh->cont (sh->cont_cls, GNUNET_SYSERR);
-    GNUNET_free (sh);
-  }
-  stop_helper (h, soft_kill);
   GNUNET_SERVER_mst_destroy (h->mst);
   GNUNET_free (h->binary_name);
   for (c = 0; h->binary_argv[c] != NULL; c++)
@@ -482,28 +517,19 @@
  * Kills the helper, closes the pipe and frees the handle
  *
  * @param h handle to helper to stop
+ * @param soft_kill if GNUNET_YES, signals termination by closing the helper's
+ *          stdin; GNUNET_NO to signal termination by sending SIGTERM to helper
  */
 void
-GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h)
+GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill)
 {
-  kill_helper (h, GNUNET_NO);
+  h->exp_cb = NULL;
+  stop_helper (h, soft_kill);
+  GNUNET_HELPER_destroy (h);
 }
 
 
 /**
- * Kills the helper by closing its stdin (the helper is expected to catch the
- * resulting SIGPIPE and shutdown), closes the pipe and frees the handle
- *
- * @param h handle to helper to stop
- */
-void
-GNUNET_HELPER_soft_stop (struct GNUNET_HELPER_Handle *h)
-{
-  kill_helper (h, GNUNET_YES);
-}
-
-
-/**
  * Write to the helper-process
  *
  * @param cls handle to the helper process
@@ -540,7 +566,7 @@
     if (NULL != h->exp_cb)
     {
       h->exp_cb (h->cb_cls);
-      GNUNET_HELPER_stop (h);
+      GNUNET_HELPER_stop (h, GNUNET_NO);
       return;
     }
     stop_helper (h, GNUNET_NO);

Modified: gnunet/src/vpn/gnunet-service-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-service-vpn.c 2013-05-08 16:53:16 UTC (rev 27073)
+++ gnunet/src/vpn/gnunet-service-vpn.c 2013-05-09 09:45:53 UTC (rev 27074)
@@ -2928,8 +2928,8 @@
     mesh_handle = NULL;
   }
   if (NULL != helper_handle)
-    {
-    GNUNET_HELPER_stop (helper_handle);
+  {
+    GNUNET_HELPER_stop (helper_handle, GNUNET_NO);
     helper_handle = NULL;
   }
   if (NULL != nc)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]