gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29803 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r29803 - gnunet/src/util
Date: Wed, 2 Oct 2013 22:47:19 +0200

Author: grothoff
Date: 2013-10-02 22:47:18 +0200 (Wed, 02 Oct 2013)
New Revision: 29803

Modified:
   gnunet/src/util/common_logging.c
   gnunet/src/util/helper.c
Log:
-fix helper: properly abort pending write tasks during helper destroy

Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c    2013-10-02 20:32:46 UTC (rev 29802)
+++ gnunet/src/util/common_logging.c    2013-10-02 20:47:18 UTC (rev 29803)
@@ -665,7 +665,9 @@
  * @return #GNUNET_OK on success
  */
 int
-GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)
+GNUNET_log_setup (const char *comp,
+                 const char *loglevel, 
+                 const char *logfile)
 {
   const char *env_logfile;
   const struct tm *tm;

Modified: gnunet/src/util/helper.c
===================================================================
--- gnunet/src/util/helper.c    2013-10-02 20:32:46 UTC (rev 29802)
+++ gnunet/src/util/helper.c    2013-10-02 20:47:18 UTC (rev 29803)
@@ -270,8 +270,8 @@
  * 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
+ * @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)
@@ -512,7 +512,22 @@
 GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h)
 {
   unsigned int c;
+  struct GNUNET_HELPER_SendHandle *sh;
 
+  if (GNUNET_SCHEDULER_NO_TASK != h->write_task)
+  {
+    GNUNET_SCHEDULER_cancel (h->write_task);
+    h->write_task = GNUNET_SCHEDULER_NO_TASK;
+  }
+  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);
+  }
   GNUNET_SERVER_mst_destroy (h->mst);
   GNUNET_free (h->binary_name);
   for (c = 0; h->binary_argv[c] != NULL; c++)
@@ -667,12 +682,12 @@
   if (0 == sh->wpos)
   {
     GNUNET_CONTAINER_DLL_remove (h->sh_head, h->sh_tail, sh);
+    GNUNET_free (sh);
     if (NULL == h->sh_head)
     {
       GNUNET_SCHEDULER_cancel (h->write_task);
       h->write_task = GNUNET_SCHEDULER_NO_TASK;
     }
-    GNUNET_free (sh);
   }
 }
 




reply via email to

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