try to fix the helper-startup and so on
authorPhilipp Tölke <toelke@in.tum.de>
Sun, 19 Jun 2011 12:34:14 +0000 (12:34 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Sun, 19 Jun 2011 12:34:14 +0000 (12:34 +0000)
src/vpn/gnunet-daemon-exit.c
src/vpn/gnunet-daemon-vpn-helper.c
src/vpn/gnunet-helper-vpn-api.c

index 08b414d5c263c37a7c3a19f75d256ae4bd4cee59..d12c59d20778a2c58c4792a9175f918d1e0c625b 100644 (file)
@@ -36,6 +36,8 @@
 #include "gnunet-helper-vpn-api.h"
 #include "gnunet-vpn-checksum.h"
 
+GNUNET_SCHEDULER_TaskIdentifier shs_task;
+
 /**
  * The handle to the configuration used throughout the process
  */
index 9a1ddd8cc1abf6b5ebe077574b830d48cf048492..e5fb59c003d5157194f08a970f14c5addb75b5a4 100644 (file)
@@ -126,6 +126,8 @@ start_helper_and_schedule(void *cls,
     restart_hijack = 1;
     if (NULL != dns_connection)
       GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL);
+
+    GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, helper_handle->fh_to_helper, &helper_write, NULL);
 }
 /*}}}*/
 
@@ -410,5 +412,6 @@ void write_to_helper(void* buf, size_t len)
 
 void schedule_helper_write(struct GNUNET_TIME_Relative time, void* cls)
 {
+  if (GNUNET_SCHEDULER_NO_TASK == shs_task) return;
   GNUNET_SCHEDULER_add_write_file (time, helper_handle->fh_to_helper, &helper_write, cls);
 }
index 195a79217e1f47e0d2d31ec6ec4d217fd413160d..1022d54e9a80714d927188196ce85e4df85bc7b6 100644 (file)
@@ -48,6 +48,8 @@ stop_helper (struct GNUNET_VPN_HELPER_Handle *handle)
   GNUNET_SERVER_mst_destroy(handle->mst);
 }
 
+extern GNUNET_SCHEDULER_TaskIdentifier shs_task;
+
 /**
  * Read from the helper-process
  */
@@ -71,7 +73,7 @@ helper_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tsdkctx)
       stop_helper (handle);
 
       /* Restart the helper */
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+      shs_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
                                     handle->restart_task, handle);
       return;
     }
@@ -84,7 +86,7 @@ helper_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tsdkctx)
       stop_helper (handle);
 
       /* Restart the helper */
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+      shs_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
                                     handle->restart_task, handle);
       return;