gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2441 - GNUnet/src/applications/gap


From: durner
Subject: [GNUnet-SVN] r2441 - GNUnet/src/applications/gap
Date: Tue, 10 Jan 2006 02:36:03 -0800 (PST)

Author: durner
Date: 2006-01-10 02:35:52 -0800 (Tue, 10 Jan 2006)
New Revision: 2441

Modified:
   GNUnet/src/applications/gap/gap.c
Log:
Hard limits for CPU & network upstream

Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c   2006-01-07 10:15:24 UTC (rev 2440)
+++ GNUnet/src/applications/gap/gap.c   2006-01-10 10:35:52 UTC (rev 2441)
@@ -500,6 +500,11 @@
 static unsigned int rewardSize = 0;
 static unsigned int rewardPos = 0;
 
+/**
+ * Hard CPU limit
+ */
+static unsigned int hardCPULimit;
+static unsigned int hardUpLimit;
 
 /* ****************** helper functions ***************** */
 
@@ -818,6 +823,11 @@
                          &qr->msg->returnTo.hashPubKey)) )
     return; /* never send back to source */
 
+  /* Load above hard limit? */
+  if ((hardLimit && getCPULoad() >= hardCPULimit) ||
+        (hardUpLimit && getNetworkLoadUp() >= hardUpLimit) )
+    return;
+
   if (getBit(qr, getIndex(id)) == 1) {
 #if DEBUG_GAP
     IFLOG(LOG_DEBUG,
@@ -2185,6 +2195,9 @@
   GROW(rewards,
        rewardSize,
        MAX_REWARD_TRACKS);
+       
+  hardCPULimit = getConfigurationInt("LOAD", "HARDCPULIMIT");
+  hardUpLimit = getConfigurationInt("LOAD", "HARDUPLIMIT");
 
   identity = coreAPI->requestService("identity");
   GNUNET_ASSERT(identity != NULL);





reply via email to

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