gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17049 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r17049 - gnunet/src/dht
Date: Tue, 27 Sep 2011 14:04:16 +0200

Author: grothoff
Date: 2011-09-27 14:04:16 +0200 (Tue, 27 Sep 2011)
New Revision: 17049

Modified:
   gnunet/src/dht/gnunet-service-dht_neighbours.c
Log:
give priority to results

Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c      2011-09-27 12:01:04 UTC 
(rev 17048)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c      2011-09-27 12:04:16 UTC 
(rev 17049)
@@ -66,6 +66,11 @@
 #define FIND_PEER_REPLICATION_LEVEL 4
 
 /**
+ * Maximum allowed replication level for all requests.
+ */
+#define MAXIMUM_REPLICATION_LEVEL 16
+
+/**
  * How often to update our preference levels for peers in our routing tables.
  */
 #define DHT_DEFAULT_PREFERENCE_INTERVAL 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 2)
@@ -80,7 +85,12 @@
  */
 #define DHT_MAXIMUM_FIND_PEER_INTERVAL 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 8)
 
+/**
+ * How long at most to wait for transmission of a GET request to another peer?
+ */
+#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 2)
 
+
 /**
  * P2P PUT message
  */
@@ -548,9 +558,8 @@
   ret->distance = distance;
 #endif
   ret->id = *peer;
-  GNUNET_CONTAINER_DLL_insert_after (k_buckets[peer_bucket].head,
-                                     k_buckets[peer_bucket].tail,
-                                     k_buckets[peer_bucket].tail, ret);
+  GNUNET_CONTAINER_DLL_insert_tail (k_buckets[peer_bucket].head,
+                                   k_buckets[peer_bucket].tail, ret);
   k_buckets[peer_bucket].peers_size++;
   closest_bucket = GNUNET_MAX (closest_bucket,
                               peer_bucket);
@@ -723,7 +732,7 @@
     return 1;
   }
   /* bound by system-wide maximum */
-  target_replication = GNUNET_MIN (16 /* FIXME: use named constant */,
+  target_replication = GNUNET_MIN (MAXIMUM_REPLICATION_LEVEL,
                                   target_replication);
   target_value =
     1 + (target_replication - 1.0) / (GDS_NSE_get () +
@@ -1086,9 +1095,9 @@
     pp = (struct GNUNET_PeerIdentity*) &ppm[1];
     memcpy (pp, put_path, sizeof (struct GNUNET_PeerIdentity) * 
put_path_length);
     memcpy (&pp[put_path_length], data, data_size);
-    GNUNET_CONTAINER_DLL_insert (target->head,
-                                target->tail,
-                                pending);
+    GNUNET_CONTAINER_DLL_insert_tail (target->head,
+                                     target->tail,
+                                     pending);
     target->pending_count++;
     process_peer_queue (target);
   }
@@ -1153,7 +1162,7 @@
     target = targets[i];
     pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); 
     pending->importance = 0; /* FIXME */
-    pending->timeout = GNUNET_TIME_relative_to_absolute 
(GNUNET_TIME_UNIT_HOURS); /* FIXME */
+    pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT);
     pgm = (struct PeerGetMessage*) &pending[1];
     pending->msg = &pgm->header;
     pgm->header.size = htons (msize);
@@ -1175,9 +1184,9 @@
                   GNUNET_CONTAINER_bloomfilter_get_raw_data (reply_bf,
                                                              &xq[xquery_size],
                                                              reply_bf_size));
-    GNUNET_CONTAINER_DLL_insert (target->head,
-                                target->tail,
-                                pending);
+    GNUNET_CONTAINER_DLL_insert_tail (target->head,
+                                     target->tail,
+                                     pending);
     target->pending_count++;
     process_peer_queue (target);
   }




reply via email to

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