gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1887 - GNUnet/src/server


From: grothoff
Subject: [GNUnet-SVN] r1887 - GNUnet/src/server
Date: Wed, 24 Aug 2005 00:42:13 -0700 (PDT)

Author: grothoff
Date: 2005-08-24 00:42:12 -0700 (Wed, 24 Aug 2005)
New Revision: 1887

Modified:
   GNUnet/src/server/connection.c
Log:
blacklisting was too assertive -- especially if run at high frequency

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2005-08-24 07:10:19 UTC (rev 1886)
+++ GNUnet/src/server/connection.c      2005-08-24 07:42:12 UTC (rev 1887)
@@ -1850,6 +1850,7 @@
   long long * adjustedRR;
   int didAssign;
   int firstRound;
+  int earlyRun;
 
   MUTEX_LOCK(&lock);
   cronTime(&now);
@@ -1877,11 +1878,14 @@
      aggressively (since we are unlikely to get close
      to the limits anyway) */
   timeDifference = now - lastRoundStart;
-  if ( (timeDifference < MIN_SAMPLE_TIME) &&
-       (activePeerCount > CONNECTION_MAX_HOSTS_ / 16) ) {
-    MUTEX_UNLOCK(&lock);
-    return; /* don't update too frequently, we need at least some
-              semi-representative sampling! */
+  earlyRun = 0;
+  if (timeDifference < MIN_SAMPLE_TIME) {
+    earlyRun = 1;
+    if  (activePeerCount > CONNECTION_MAX_HOSTS_ / 16) {
+      MUTEX_UNLOCK(&lock);
+      return; /* don't update too frequently, we need at least some
+                semi-representative sampling! */
+    }
   }
   if (timeDifference == 0)
     timeDifference = 1;
@@ -1947,11 +1951,15 @@
      * reasonable and make the check against the max value we have
      * sent to this peer (assume announcements may have got lost).
      */
-    if (adjustedRR[u] > 2 * MAX_BUF_FACT *
-       entries[u]->max_transmitted_limit) {
+    if ( (earlyRun == 0) &&
+        (adjustedRR[u] > 2 * MAX_BUF_FACT *
+         entries[u]->max_transmitted_limit) &&
+        (adjustedRR[u] > 2 * MAX_BUF_FACT *
+         entries[u]->idealized_limit) ) {       
       EncName enc;
 
       entries[u]->violations++;
+      entries[u]->recently_received = 0; /* "clear" slate */
       if (entries[u]->violations > 10) {
        IFLOG(LOG_INFO,
              hash2enc(&entries[u]->session.sender.hashPubKey,
@@ -1975,7 +1983,8 @@
        continue;
       }
     } else {
-      if ( (adjustedRR[u] < entries[u]->max_transmitted_limit/2) &&
+      if ( (earlyRun == 0) &&
+          (adjustedRR[u] < entries[u]->max_transmitted_limit/2) &&
           (entries[u]->violations > 0) ) {
        /* allow very low traffic volume to
           balance out (rare) times of high
@@ -1983,7 +1992,7 @@
        entries[u]->violations--;
       }
     }
-
+    
     if (adjustedRR[u] < MIN_BPM_PER_PEER/2)
       adjustedRR[u] = MIN_BPM_PER_PEER/2; 
     /* even if we received NO traffic, allow





reply via email to

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