gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r21927 - gnunet/src/dht
Date: Tue, 12 Jun 2012 21:23:11 +0200

Author: grothoff
Date: 2012-06-12 21:23:11 +0200 (Tue, 12 Jun 2012)
New Revision: 21927

Modified:
   gnunet/src/dht/gnunet-service-dht_neighbours.c
Log:
-fixing #2420

Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c      2012-06-12 19:07:40 UTC 
(rev 21926)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c      2012-06-12 19:23:11 UTC 
(rev 21927)
@@ -70,6 +70,11 @@
 #define MAXIMUM_REPLICATION_LEVEL 16
 
 /**
+ * Maximum allowed number of pending messages per peer.
+ */
+#define MAXIMUM_PENDING_PER_PEER 64
+
+/**
  * 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)
@@ -301,8 +306,7 @@
   struct PeerInfo *prev;
 
   /**
-   * Count of outstanding messages for peer.  FIXME: NEEDED?
-   * FIXME: bound queue size!?
+   * Count of outstanding messages for peer. 
    */
   unsigned int pending_count;
 
@@ -1238,6 +1242,12 @@
   for (i = 0; i < target_count; i++)
   {
     target = targets[i];
+    if (target->pending_count >= MAXIMUM_PENDING_PER_PEER)
+    {
+      GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages 
dropped due to full queue"),
+                               1, GNUNET_NO);
+      continue; /* skip */
+    }
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Routing PUT for %s after %u hops to %s\n", GNUNET_h2s (key),
                 (unsigned int) hop_count, GNUNET_i2s (&target->id));
@@ -1345,6 +1355,12 @@
   for (i = 0; i < target_count; i++)
   {
     target = targets[i];
+    if (target->pending_count >= MAXIMUM_PENDING_PER_PEER)
+    {
+      GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages 
dropped due to full queue"),
+                               1, GNUNET_NO);
+      continue; /* skip */
+    }
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Routing GET for %s after %u hops to %s\n", GNUNET_h2s (key),
                 (unsigned int) hop_count, GNUNET_i2s (&target->id));
@@ -1438,6 +1454,14 @@
     /* peer disconnected in the meantime, drop reply */
     return;
   }
+  if (pi->pending_count >= MAXIMUM_PENDING_PER_PEER)
+  {
+    /* skip */
+    GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages dropped 
due to full queue"),
+                             1, GNUNET_NO);
+    return;
+  }
+
   GNUNET_STATISTICS_update (GDS_stats,
                             gettext_noop
                             ("# RESULT messages queued for transmission"), 1,




reply via email to

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