committing so line numbers match
authorNathan S. Evans <evans@in.tum.de>
Wed, 8 Sep 2010 08:57:11 +0000 (08:57 +0000)
committerNathan S. Evans <evans@in.tum.de>
Wed, 8 Sep 2010 08:57:11 +0000 (08:57 +0000)
src/dht/gnunet-service-dht.c

index 5f08c8a0d5b0c96cee42be24ac71e42e8d819c78..5d0560d8387ae0bf55e3d860cf503c55c3cd72f6 100644 (file)
@@ -671,6 +671,16 @@ static unsigned int stop_on_found;
  */
 static unsigned int do_find_peer;
 
+/**
+ * Once we have stored an item in the DHT, refresh it
+ * according to our republish interval.
+ */
+static unsigned int do_republish;
+
+/**
+ * Use the "real" distance metric when selecting the
+ * next routing hop.  Can be less accurate.
+ */
 static unsigned int use_real_distance;
 
 /**
@@ -2401,7 +2411,7 @@ handle_dht_put (void *cls,
                                   (char *) &put_msg[1], put_type,
                                   GNUNET_TIME_absolute_ntoh(put_msg->expiration));
 
-      if (ret == GNUNET_YES)
+      if ((ret == GNUNET_YES) && (do_republish == GNUNET_YES))
         {
           put_context = GNUNET_malloc(sizeof(struct RepublishContext));
           memcpy(&put_context->key, &message_context->key, sizeof(GNUNET_HashCode));
@@ -4095,6 +4105,11 @@ run (void *cls,
       malicious_dropper = GNUNET_YES;
     }
 
+  if (GNUNET_YES ==
+        GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht",
+                                             "republish"))
+    do_republish = GNUNET_NO;
+
   if (GNUNET_NO ==
         GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht",
                                              "do_find_peer"))