fixing 1830
authorChristian Grothoff <christian@grothoff.org>
Wed, 19 Oct 2011 20:07:13 +0000 (20:07 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 19 Oct 2011 20:07:13 +0000 (20:07 +0000)
src/fs/gnunet-service-fs_pe.c
src/fs/gnunet-service-fs_pr.c
src/fs/perf_gnunet_service_fs_p2p.c

index 6bf85df929bcc67f14ac4fa709ee14caf3a2dab9..4555355d21207ca5149c7b5402eb8996d37f3283 100644 (file)
@@ -229,25 +229,25 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp)
                          total_delay * 1000LL / plan_count, GNUNET_NO);
   prd = GSF_pending_request_get_data_ (rp->prl_head->pr);
   // FIXME: calculate 'rp->priority'!
-#if 0
-  if (rp->transmission_counter < 32)
+  if (rp->transmission_counter < 8)
     delay =
         GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
-                                       1LL << rp->transmission_counter);
-  else
-    delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX);
-#else
-  if (rp->transmission_counter < 32)
-    delay =
-        GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
-                                       rp->transmission_counter);
+                                      rp->transmission_counter);
   else if (rp->transmission_counter < 32)
     delay =
         GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
-                                       32 + (1LL << rp->transmission_counter));
+                                       8 + (1LL << (rp->transmission_counter - 8)));
   else
-    delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX);
-#endif
+    delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 
+                                          8 + (1LL << 24));
+  delay.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+                                             delay.rel_value + 1);
+  if (rp->transmission_counter != 0)
+    delay.rel_value += TTL_DECREMENT;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Considering (re)transmission number %u in %llu ms\n",
+             (unsigned int) rp->transmission_counter,
+             (unsigned long long) delay.rel_value);
   rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay);
 #if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
index 7d205fef96e4206112c719578628f627acef4768..63ae3a75ff8ccce5ef1a1a462c5ca4c2cdb60933 100644 (file)
@@ -175,6 +175,12 @@ static struct GNUNET_LOAD_Value *datastore_put_load;
 static int active_to_migration;
 
 
+/**
+ * Size of the datastore queue we assume for common requests.
+ * Determined based on the network quota.
+ */
+static unsigned int datastore_queue_size;
+
 /**
  * Heap with the request that will expire next at the top.  Contains
  * pointers of type "struct PendingRequest*"; these will *also* be
@@ -1225,7 +1231,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size,
                                   /* queue priority */ ,
                                   (0 !=
                                    (GSF_PRO_PRIORITY_UNLIMITED &
-                                    pr->public_data.options)) ? UINT_MAX : 16
+                                    pr->public_data.options)) ? UINT_MAX : datastore_queue_size
                                   /* max queue size */ ,
                                   GNUNET_TIME_UNIT_FOREVER_REL,
                                   &process_local_reply, pr);
@@ -1264,7 +1270,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size,
                                   /* queue priority */ ,
                                   (0 !=
                                    (GSF_PRO_PRIORITY_UNLIMITED &
-                                    pr->public_data.options)) ? UINT_MAX : 16
+                                    pr->public_data.options)) ? UINT_MAX : datastore_queue_size
                                   /* max queue size */ ,
                                   GNUNET_TIME_UNIT_FOREVER_REL,
                                   &process_local_reply, pr);
@@ -1323,7 +1329,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size,
                                 /* queue priority */ ,
                                 (0 !=
                                  (GSF_PRO_PRIORITY_UNLIMITED & pr->
-                                  public_data.options)) ? UINT_MAX : 16
+                                  public_data.options)) ? UINT_MAX : datastore_queue_size
                                 /* max queue size */ ,
                                 GNUNET_TIME_UNIT_FOREVER_REL,
                                 &process_local_reply, pr);
@@ -1399,7 +1405,7 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr,
                                 /* queue priority */ ,
                                 (0 !=
                                  (GSF_PRO_PRIORITY_UNLIMITED & pr->
-                                  public_data.options)) ? UINT_MAX : 16
+                                  public_data.options)) ? UINT_MAX : datastore_queue_size
                                 /* max queue size */ ,
                                 GNUNET_TIME_UNIT_FOREVER_REL,
                                 &process_local_reply, pr);
@@ -1547,6 +1553,8 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
 void
 GSF_pending_request_init_ ()
 {
+  unsigned long long bps;
+
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (GSF_cfg, "fs",
                                              "MAX_PENDING_REQUESTS",
@@ -1557,6 +1565,22 @@ GSF_pending_request_init_ ()
                 ("Configuration fails to specify `%s', assuming default value."),
                 "MAX_PENDING_REQUESTS");
   }
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_number (GSF_cfg,
+                                            "core",
+                                            "TOTAL_QUOTA_OUT",
+                                            &bps))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                _
+                ("Configuration fails to specify `%s', assuming default value."),
+                "TOTAL_QUOTA_IN");
+    bps = 65536;
+  }
+  /* queue size should be #queries we can have pending and satisfy within
+     a carry interval: */
+  datastore_queue_size = bps * GNUNET_CONSTANTS_MAX_BANDWIDTH_CARRY_S / DBLOCK_SIZE;
+  
   active_to_migration =
       GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg, "FS", "CONTENT_CACHING");
   datastore_put_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE);
index bb8c8d8c21ffbd2bec44d3f9dc4f9d15c27be06f..66dc38b230656771d7f596dea7f95bb26544b6dc 100644 (file)
@@ -32,7 +32,7 @@
 /**
  * File-size we use for testing.
  */
-#define FILESIZE (1024 * 1024 * 10)
+#define FILESIZE (1024 * 1024 * 100)
 
 /**
  * How long until we give up on transmitting the message?