gnunet-svn
[Top][All Lists]
Advanced

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

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


From: durner
Subject: [GNUnet-SVN] r2329 - GNUnet/src/server
Date: Thu, 15 Dec 2005 12:08:21 -0800 (PST)

Author: durner
Date: 2005-12-15 12:07:04 -0800 (Thu, 15 Dec 2005)
New Revision: 2329

Modified:
   GNUnet/src/server/connection.c
Log:
expire less often (ease CPU load)

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2005-12-15 12:41:13 UTC (rev 2328)
+++ GNUnet/src/server/connection.c      2005-12-15 20:07:04 UTC (rev 2329)
@@ -397,6 +397,10 @@
   /* are we currently in "sendBuffer" for this
      entry? */
   int inSendBuffer;
+  
+  /* when were old entries expired last? */
+  cron_t lastExpiry;
+  
 } BufferEntry;
 
 typedef struct {
@@ -564,6 +568,8 @@
   be->inSendBuffer
     = NO;
   cronTime(&be->last_bps_update); /* now */
+  be->lastExpiry = be->last_bps_update;
+
   return be;
 }
 
@@ -1037,6 +1043,11 @@
   unsigned long long usedBytes;
   int j;
 
+  if (cronTime(NULL) < be->lastExpiry + SECONDS_PINGATTEMPT * cronSECONDS)
+    return;
+  else
+    cronTime(&be->lastExpiry);
+
   /* if it's more than one connection "lifetime" old, always kill it! */
   expired = cronTime(&be->lastSendAttempt) - SECONDS_PINGATTEMPT * cronSECONDS;
 #if DEBUG_CONNECTION





reply via email to

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