From cf2b5b068fe12986ebe4c21a2ce1fa04f5881c55 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Tue, 20 Jul 2010 08:20:39 +0000 Subject: [PATCH] CG could answer my questions --- src/vpn/gnunet-daemon-vpn.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 875ebf018..5cc832127 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c @@ -40,14 +40,14 @@ struct vpn_cls { struct GNUNET_DISK_PipeHandle* helper_out; const struct GNUNET_DISK_FileHandle* fh_from_helper; - struct GNUNET_SCHEDULER_Handle *sched; // TODO CG: is that right? Do I have to carry it around myself? + struct GNUNET_SCHEDULER_Handle *sched; pid_t helper_pid; }; static void cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { struct vpn_cls* mycls = (struct vpn_cls*) cls; - if (tskctx->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) { + if (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) { PLIBC_KILL(mycls->helper_pid, SIGTERM); GNUNET_OS_process_wait(mycls->helper_pid); } @@ -59,6 +59,9 @@ static void helper_read(void* cls, const struct GNUNET_SCHEDULER_TaskContext* ts int r = 0; + if (tsdkctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) + return; + while (r < sizeof(struct suid_packet_header)) { int t = GNUNET_DISK_file_read(mycls->fh_from_helper, &hdr, sizeof(struct suid_packet_header)); if (t< 0) { -- 2.25.1