gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13191 - in gnunet: . src/block src/include src/vpn


From: gnunet
Subject: [GNUnet-SVN] r13191 - in gnunet: . src/block src/include src/vpn
Date: Thu, 7 Oct 2010 10:01:46 +0200

Author: grothoff
Date: 2010-10-07 10:01:46 +0200 (Thu, 07 Oct 2010)
New Revision: 13191

Modified:
   gnunet/TODO
   gnunet/src/block/plugin_block.h
   gnunet/src/include/gnunet_block_lib.h
   gnunet/src/vpn/gnunet-daemon-vpn.c
Log:
stuff

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-10-07 05:41:58 UTC (rev 13190)
+++ gnunet/TODO 2010-10-07 08:01:46 UTC (rev 13191)
@@ -99,7 +99,15 @@
   - performance tests
 * BLOCK:
   - more testing (KBlock, SBlock, NBlock)
+* FS migration:
+  - exclude content that will "soon" expire from migration?
+  - exclude content with zero-anonymity from gap migration?
+  - make migration data rate & datastore IO-rate configurable
+  - exclude certain peers as targets (based on hash values) in each
+    iteration => same peer can only be picked every n-th iteration 
+    for the same content => fewer duplicate sending!
 
+
 0.9.1:
 * TRANSPORT: [MW]
   - WiFi transport backend [DB]

Modified: gnunet/src/block/plugin_block.h
===================================================================
--- gnunet/src/block/plugin_block.h     2010-10-07 05:41:58 UTC (rev 13190)
+++ gnunet/src/block/plugin_block.h     2010-10-07 08:01:46 UTC (rev 13191)
@@ -32,7 +32,6 @@
 #include "gnunet_block_lib.h"
 
 
-
 /**
  * Function called to validate a reply or a request.  For
  * request evaluation, simply pass "NULL" for the reply_block.
@@ -71,7 +70,9 @@
  * @param block block to get the key for
  * @param block_size number of bytes in block
  * @param key set to the key (query) for the given block
- * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported
+ * @return GNUNET_YES on success, 
+ *         GNUNET_NO if the block is malformed
+ *         GNUNET_SYSERR if type not supported
  *         (or if extracting a key from a block of this type does not work)
  */
 typedef int

Modified: gnunet/src/include/gnunet_block_lib.h
===================================================================
--- gnunet/src/include/gnunet_block_lib.h       2010-10-07 05:41:58 UTC (rev 
13190)
+++ gnunet/src/include/gnunet_block_lib.h       2010-10-07 08:01:46 UTC (rev 
13191)
@@ -219,7 +219,7 @@
  * @param block block to get the key for
  * @param block_size number of bytes in block
  * @param key set to the key (query) for the given block
- * @return GNUNET_OK on success, 
+ * @return GNUNET_YES on success, 
  *         GNUNET_NO if the block is malformed
  *         GNUNET_SYSERR if type not supported
  *         (or if extracting a key from a block of this type does not work)

Modified: gnunet/src/vpn/gnunet-daemon-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn.c  2010-10-07 05:41:58 UTC (rev 13190)
+++ gnunet/src/vpn/gnunet-daemon-vpn.c  2010-10-07 08:01:46 UTC (rev 13191)
@@ -68,10 +68,14 @@
 static struct vpn_cls mycls;
 
 static void cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* 
tskctx) {
-       if (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) {
-               PLIBC_KILL(mycls.helper_pid, SIGTERM);
-               GNUNET_OS_process_wait(mycls.helper_pid);
-       }
+  GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN));
+  PLIBC_KILL(mycls.helper_pid, SIGTERM);
+  GNUNET_OS_process_wait(mycls.helper_pid);
+  if (mycls.dns_connection != NULL)
+    {
+      GNUNET_CLIENT_disconnect (mycls.dns_connection);
+      mycls.dns_connection = NULL;
+    }
 }
 
 static void helper_read(void* cls, const struct GNUNET_SCHEDULER_TaskContext* 
tsdkctx);
@@ -256,33 +260,50 @@
 
 }
 
-void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg);
+static void 
+dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg);
 
-void reconnect_to_service_dns() {
-    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting\n");
-    if (mycls.dns_connection != NULL) {
-      GNUNET_CLIENT_disconnect(mycls.dns_connection, 1);
-    }
-    mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", 
mycls.cfg);
-
-    GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, 
GNUNET_TIME_UNIT_FOREVER_REL);
+static void 
+reconnect_to_service_dns (void *cls,
+                         const struct GNUNET_SCHEDULER_TaskContext *tc) {
+  if (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+    return;
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting\n");
+  GNUNET_assert (mycls.dns_connection == NULL);
+  mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", 
mycls.cfg); 
+  GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, 
GNUNET_TIME_UNIT_FOREVER_REL);
 }
 
-void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) {
-       if (msg == NULL) return reconnect_to_service_dns();
+static void 
+dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) 
+{
+  if (msg == NULL) 
+    {
+      GNUNET_CLIENT_disconnect(mycls.dns_connection, GNUNET_NO);
+      mycls.dns_connection = NULL;
+      GNUNET_SCHEDULER_add_delayed (mycls.sched,
+                                   GNUNET_TIME_UNIT_SECONDS,
+                                   &reconnect_to_service_dns,
+                                   NULL);
+      return;
+    }
 
-       if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) goto 
out;
-
-       struct answer_packet_list* pkt = GNUNET_malloc(ntohs(msg->size) + 
2*sizeof(struct answer_packet_list*));
-
-       memcpy(&pkt->pkt, msg, ntohs(msg->size));
-
-       GNUNET_CONTAINER_DLL_insert_after(mycls.answer_head, mycls.answer_tail, 
mycls.answer_tail, pkt);
-
-       GNUNET_SCHEDULER_add_write_file (mycls.sched, 
GNUNET_TIME_UNIT_FOREVER_REL, mycls.fh_to_helper, &helper_write, NULL);
-
-out:
-       GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, 
GNUNET_TIME_UNIT_FOREVER_REL);
+  if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) 
+    {
+      GNUNET_break (0);
+      GNUNET_CLIENT_disconnect(mycls.dns_connection, GNUNET_NO);
+      mycls.dns_connection = NULL;
+      GNUNET_SCHEDULER_add_now (mycls.sched,
+                               &reconnect_to_service_dns,
+                               NULL);
+      return;
+    }  
+  struct answer_packet_list* pkt = GNUNET_malloc(ntohs(msg->size) + 
2*sizeof(struct answer_packet_list*));
+  
+  memcpy(&pkt->pkt, msg, ntohs(msg->size));
+  GNUNET_CONTAINER_DLL_insert_after(mycls.answer_head, mycls.answer_tail, 
mycls.answer_tail, pkt);  
+  GNUNET_SCHEDULER_add_write_file (mycls.sched, GNUNET_TIME_UNIT_FOREVER_REL, 
mycls.fh_to_helper, &helper_write, NULL);
+  GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, 
GNUNET_TIME_UNIT_FOREVER_REL);
 }
 
 /**
@@ -303,11 +324,8 @@
 {
   mycls.sched = sched;
   mycls.mst = GNUNET_SERVER_mst_create(&message_token, NULL);
-
   mycls.cfg = cfg;
-
-  reconnect_to_service_dns();
-
+  GNUNET_SCHEDULER_add_now (sched, &reconnect_to_service_dns, NULL);
   GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, 
cls); 
   start_helper_and_schedule(mycls);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]