CG could answer my questions
authorPhilipp Tölke <toelke@in.tum.de>
Tue, 20 Jul 2010 08:20:39 +0000 (08:20 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Tue, 20 Jul 2010 08:20:39 +0000 (08:20 +0000)
src/vpn/gnunet-daemon-vpn.c

index 875ebf018e3a162ed67471da06648db22aebf41b..5cc8321276148d4be5e080143f7ff7e38a181546 100644 (file)
@@ -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) {