gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5189 - in GNUnet/src: applications/gap applications/identi


From: gnunet
Subject: [GNUnet-SVN] r5189 - in GNUnet/src: applications/gap applications/identity server
Date: Sat, 30 Jun 2007 18:26:14 -0600 (MDT)

Author: grothoff
Date: 2007-06-30 18:26:14 -0600 (Sat, 30 Jun 2007)
New Revision: 5189

Modified:
   GNUnet/src/applications/gap/gap.c
   GNUnet/src/applications/identity/identity.c
   GNUnet/src/server/connection.c
Log:
more work on blacklisting

Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c   2007-06-30 11:37:04 UTC (rev 5188)
+++ GNUnet/src/applications/gap/gap.c   2007-07-01 00:26:14 UTC (rev 5189)
@@ -1603,6 +1603,8 @@
     GE_BREAK_OP(ectx, 0);
     return SYSERR; /* invalid! */
   }
+  if (host != NULL)
+    coreAPI->confirmSessionUp(host);
   msg = (const P2P_gap_reply_MESSAGE *) pmsg;
 #if DEBUG_GAP
   IF_GELOG(ectx,
@@ -1977,7 +1979,8 @@
     GE_BREAK(ectx, 0);
     return 0;
   }
-
+  if (sender != NULL)
+    coreAPI->confirmSessionUp(sender);
   /* Load above hard limit? */
   if (loadTooHigh()) {
 #if DEBUG_GAP

Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2007-06-30 11:37:04 UTC (rev 
5188)
+++ GNUnet/src/applications/identity/identity.c 2007-07-01 00:26:14 UTC (rev 
5189)
@@ -839,6 +839,7 @@
   EncName hn;
   HostEntry * entry;
   int i;
+  cron_t now;
 
   GE_ASSERT(ectx,
            numberOfHosts_ <= sizeOfHosts_);
@@ -858,15 +859,24 @@
     MUTEX_UNLOCK(lock_);
     return SYSERR;
   }
-  if (strict == YES) {
-    entry->delta = desperation;
+  now = get_time();
+  if (entry->until < now) {
+    if (strict)
+      entry->delta = desperation;
+    else
+      entry->delta
+       = weak_randomi(1+desperation*cronSECONDS);
   } else {
-    entry->delta
-      = entry->delta + weak_randomi(1+desperation*cronSECONDS);
-    if (entry->delta > 4 * cronHOURS)
-      entry->delta = 4 * cronHOURS;
+    if (strict)
+      entry->delta
+       += desperation;
+    else
+      entry->delta
+       += weak_randomi(1+desperation*cronSECONDS);
   }
-  entry->until = get_time() + entry->delta;
+  if (entry->delta > 4 * cronHOURS)
+    entry->delta = 4 * cronHOURS;
+  entry->until = now + entry->delta;
   entry->strict = strict;
   hash2enc(&identity->hashPubKey,
           &hn);

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2007-06-30 11:37:04 UTC (rev 5188)
+++ GNUnet/src/server/connection.c      2007-07-01 00:26:14 UTC (rev 5189)
@@ -95,7 +95,8 @@
 /**
  * After 2 minutes on an inactive connection, probe the other
  * node with a ping if we have achieved less than 50% of our
- * connectivity goal.
+ * connectivity goal.  Also, messages that are older than 
+ * this value are discarded as too old.
  */
 #define SECONDS_PINGATTEMPT 120
 
@@ -114,6 +115,13 @@
 #define SECONDS_BLACKLIST_AFTER_DISCONNECT 300
 
 /**
+ * How long should we blacklist a peer after a
+ * failed connect?  For now, 2 minutes (should
+ * probably be much higher).
+ */
+#define SECONDS_BLACKLIST_AFTER_FAILED_CONNECT 120
+
+/**
  * If we under-shoot our bandwidth limitation in one time period, how
  * much of that limit are we allowed to 'roll-over' into the next
  * period?  The number given here is a factor of the total per-minute
@@ -2470,7 +2478,7 @@
             be->idealized_limit);
 #endif
       /* We need to avoid giving a too low limit (especially 0, which
-        would indicate a plaintex msg).  So we set the limit to the
+        would indicate a plaintext msg).  So we set the limit to the
         minimum value AND try to shutdown the connection. */
       be->idealized_limit = MIN_BPM_PER_PEER;
       /* do not try to reconnect any time soon! */
@@ -2569,10 +2577,10 @@
                 &enc,
                 now - root->isAlive);
 #endif
-         /* do not try to reconnect any time soon! */
-         identity->blacklistHost(&root->session.sender,
-                                 SECONDS_BLACKLIST_AFTER_DISCONNECT, 
-                                 YES);
+         /* this was a valuable peer except for the timeout,
+            let's keep it as a possibility for the near
+            future! */
+         identity->whitelistHost(&root->session.sender);
           shutdownConnection(root);
 
         }
@@ -2634,7 +2642,7 @@
 #endif
          /* do not try to reconnect any time soon! */
          identity->blacklistHost(&root->session.sender,
-                                 SECONDS_BLACKLIST_AFTER_DISCONNECT,
+                                 SECONDS_BLACKLIST_AFTER_FAILED_CONNECT,
                                  YES);
           shutdownConnection(root);
         }





reply via email to

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