FIXMEs
authorPhilipp Tölke <toelke@in.tum.de>
Sun, 10 Apr 2011 13:19:29 +0000 (13:19 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Sun, 10 Apr 2011 13:19:29 +0000 (13:19 +0000)
src/vpn/gnunet-daemon-vpn-helper.c
src/vpn/gnunet-helper-vpn-api.c

index b5f83f9db0355aab995aac8a93c54c26335a9838..fdb5dddaaed691eeed4780c3d0f0738728e85c8f 100644 (file)
@@ -40,6 +40,7 @@
 #include "gnunet-service-dns-p.h"
 #include "gnunet-vpn-packet.h"
 #include "gnunet-vpn-checksum.h"
+#include "gnunet-helper-vpn-api.h"
 
 struct GNUNET_VPN_HELPER_Handle *helper_handle;
 
@@ -185,7 +186,12 @@ helper_write(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tsdkctx) {
     GNUNET_CONTAINER_DLL_remove (answer_proc_head, answer_proc_tail, ans);
     GNUNET_free(ans);
 
-    /* FIXME */ GNUNET_DISK_file_write(helper_handle->fh_to_helper, pkt, pkt_len);
+    if (GNUNET_DISK_file_write(helper_handle->fh_to_helper, pkt, pkt_len) < 0)
+      {
+        cleanup_helper(helper_handle);
+        GNUNET_SCHEDULER_add_now(start_helper_and_schedule, NULL);
+        return;
+      }
 
     /* if more packets are available, reschedule */
     if (answer_proc_head != NULL)
index 486dfe042a32de6cd7131930648faa3c0c72b3c8..5736df2b104050b9cbf3a3dd4d0b9b6515d7709c 100644 (file)
@@ -76,8 +76,19 @@ helper_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tsdkctx)
       return;
     }
 
-  /* FIXME */ GNUNET_SERVER_mst_receive (handle->mst, handle->client, buf, t,
-                                         0, 0);
+  if (GNUNET_SYSERR ==
+      GNUNET_SERVER_mst_receive (handle->mst, handle->client, buf, t, 0, 0))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "SYSERR from mst\n");
+      stop_helper (handle);
+
+      /* Restart the helper */
+      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+                                    handle->restart_task, handle);
+      return;
+
+    }
 
   GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
                                   handle->fh_from_helper, &helper_read,