From 07870c9466ab919dc65cfb93e80254ea207999bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Sun, 19 Jun 2011 12:34:14 +0000 Subject: [PATCH] try to fix the helper-startup and so on --- src/vpn/gnunet-daemon-exit.c | 2 ++ src/vpn/gnunet-daemon-vpn-helper.c | 3 +++ src/vpn/gnunet-helper-vpn-api.c | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c index 08b414d5c..d12c59d20 100644 --- a/src/vpn/gnunet-daemon-exit.c +++ b/src/vpn/gnunet-daemon-exit.c @@ -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 */ diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index 9a1ddd8cc..e5fb59c00 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c @@ -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); } diff --git a/src/vpn/gnunet-helper-vpn-api.c b/src/vpn/gnunet-helper-vpn-api.c index 195a79217..1022d54e9 100644 --- a/src/vpn/gnunet-helper-vpn-api.c +++ b/src/vpn/gnunet-helper-vpn-api.c @@ -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; -- 2.25.1