gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r29805 - gnunet/src/util
Date: Wed, 2 Oct 2013 22:56:46 +0200

Author: grothoff
Date: 2013-10-02 22:56:46 +0200 (Wed, 02 Oct 2013)
New Revision: 29805

Modified:
   gnunet/src/util/helper.c
Log:
-do cancel read task as well

Modified: gnunet/src/util/helper.c
===================================================================
--- gnunet/src/util/helper.c    2013-10-02 20:49:01 UTC (rev 29804)
+++ gnunet/src/util/helper.c    2013-10-02 20:56:46 UTC (rev 29805)
@@ -169,10 +169,11 @@
  * @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
+ * @return #GNUNET_OK on success; #GNUNET_SYSERR on error
  */
 int
-GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, int soft_kill)
+GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, 
+                   int soft_kill)
 {
   struct GNUNET_HELPER_SendHandle *sh;
   int ret;
@@ -191,6 +192,11 @@
     GNUNET_SCHEDULER_cancel (h->restart_task);
     h->restart_task = GNUNET_SCHEDULER_NO_TASK;
   }
+  if (GNUNET_SCHEDULER_NO_TASK != h->read_task)
+  {
+    GNUNET_SCHEDULER_cancel (h->read_task);
+    h->read_task = GNUNET_SCHEDULER_NO_TASK;
+  }
   if (NULL == h->helper_proc)
     return GNUNET_SYSERR;
   if (GNUNET_YES == soft_kill)
@@ -214,7 +220,7 @@
  * calling this function
  *
  * @param h the helper handle
- * @return GNUNET_OK on success; GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success; #GNUNET_SYSERR on error
  */
 int
 GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h)
@@ -274,7 +280,8 @@
  *          stdin; #GNUNET_NO to signal termination by sending SIGTERM to 
helper
  */
 static void
-stop_helper (struct GNUNET_HELPER_Handle *h, int soft_kill)
+stop_helper (struct GNUNET_HELPER_Handle *h, 
+            int soft_kill)
 {
   if (GNUNET_SCHEDULER_NO_TASK != h->restart_task)
   {
@@ -519,6 +526,8 @@
     GNUNET_SCHEDULER_cancel (h->write_task);
     h->write_task = GNUNET_SCHEDULER_NO_TASK;
   }
+  GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->read_task);
+  GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->restart_task);
   while (NULL != (sh = h->sh_head))
   {
     GNUNET_CONTAINER_DLL_remove (h->sh_head,
@@ -545,7 +554,8 @@
  *          stdin; #GNUNET_NO to signal termination by sending SIGTERM to 
helper
  */
 void
-GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill)
+GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, 
+                   int soft_kill)
 {
   h->exp_cb = NULL;
   stop_helper (h, soft_kill);




reply via email to

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