[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5643 - in GNUnet/src: applications/advertising application
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5643 - in GNUnet/src: applications/advertising applications/gap applications/session include server util/os |
Date: |
Mon, 17 Sep 2007 22:58:22 -0600 (MDT) |
Author: grothoff
Date: 2007-09-17 22:58:21 -0600 (Mon, 17 Sep 2007)
New Revision: 5643
Modified:
GNUnet/src/applications/advertising/bootstrap.c
GNUnet/src/applications/gap/gap.c
GNUnet/src/applications/gap/gap.h
GNUnet/src/applications/session/connect.c
GNUnet/src/include/gnunet_util_core.h
GNUnet/src/server/connection.c
GNUnet/src/util/os/statuscalls.c
Log:
hopefully fixing #1273
Modified: GNUnet/src/applications/advertising/bootstrap.c
===================================================================
--- GNUnet/src/applications/advertising/bootstrap.c 2007-09-17 07:34:11 UTC
(rev 5642)
+++ GNUnet/src/applications/advertising/bootstrap.c 2007-09-18 04:58:21 UTC
(rev 5643)
@@ -141,10 +141,10 @@
char *data;
now = get_time ();
- if (coreAPI->forAllConnectedNodes (NULL, NULL) >= 3)
+ if (coreAPI->forAllConnectedNodes (NULL, NULL) >= MIN_CONNECTION_TARGET)
{
/* still change delta and lastTest; even
- if the peer _briefly_ drops below 3
+ if the peer _briefly_ drops below MCT
connections, we don't want it to immediately
go for the hostlist... */
delta = 5 * cronMINUTES;
Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c 2007-09-17 07:34:11 UTC (rev 5642)
+++ GNUnet/src/applications/gap/gap.c 2007-09-18 04:58:21 UTC (rev 5643)
@@ -219,14 +219,14 @@
unsigned int netLoad = os_network_monitor_get_load (coreAPI->load_monitor,
Upload);
- if ((netLoad == (unsigned int) -1) || (netLoad < IDLE_LOAD_THRESHOLD))
+ if ((netLoad == (unsigned int) -1) || (netLoad < GAP_IDLE_LOAD_THRESHOLD))
{
*priority = 0; /* minimum priority, no charge! */
return QUERY_ANSWER | QUERY_FORWARD | QUERY_INDIRECT;
}
/* charge! */
(*priority) = -identity->changeHostTrust (sender, -(*priority));
- if (netLoad < IDLE_LOAD_THRESHOLD + (*priority))
+ if (netLoad < GAP_IDLE_LOAD_THRESHOLD + (*priority))
return QUERY_ANSWER | QUERY_FORWARD | QUERY_INDIRECT;
else if (netLoad < 90 + 10 * (*priority))
return QUERY_ANSWER | QUERY_FORWARD;
Modified: GNUnet/src/applications/gap/gap.h
===================================================================
--- GNUnet/src/applications/gap/gap.h 2007-09-17 07:34:11 UTC (rev 5642)
+++ GNUnet/src/applications/gap/gap.h 2007-09-18 04:58:21 UTC (rev 5643)
@@ -47,9 +47,9 @@
/**
* Until which load do we consider the peer idle and do not
* charge at all? (should be larger than IDLE_LOAD_THRESHOLD used
- * by server/connection.c!)
+ * by the rest of the code)!
*/
-#define IDLE_LOAD_THRESHOLD 85
+#define GAP_IDLE_LOAD_THRESHOLD ((100 + IDLE_LOAD_THRESHOLD) / 2)
/**
* For how many different hosts can we have a query pending (at most).
Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c 2007-09-17 07:34:11 UTC (rev
5642)
+++ GNUnet/src/applications/session/connect.c 2007-09-18 04:58:21 UTC (rev
5643)
@@ -597,7 +597,9 @@
NULL,
NULL,
YES)) &&
- (YES == identity->isBlacklisted (sender, NO)))
+ ( (YES == identity->isBlacklisted (sender, NO)) ||
+ ( (coreAPI->forAllConnectedNodes (NULL, NULL) >= 3) &&
+ (os_cpu_get_load(ectx, coreAPI->cfg) > IDLE_LOAD_THRESHOLD)) ) )
return SYSERR; /* other peer initiated but is
listed as not allowed => discard */
Modified: GNUnet/src/include/gnunet_util_core.h
===================================================================
--- GNUnet/src/include/gnunet_util_core.h 2007-09-17 07:34:11 UTC (rev
5642)
+++ GNUnet/src/include/gnunet_util_core.h 2007-09-18 04:58:21 UTC (rev
5643)
@@ -31,8 +31,24 @@
#include "gnunet_util.h"
#include "gnunet_util_crypto.h"
+/**
+ * Minimum number of connections for any peer
+ * (if we fall below this, strong countermeasures
+ * maybe used).
+ */
+#define MIN_CONNECTION_TARGET 4
/**
+ * Until which load do we consider the peer overly idle
+ * (which means that we would like to use more resources).<p>
+ *
+ * Note that we use 70 to leave some room for applications
+ * to consume resources "idly" (i.e. up to 85%) and then
+ * still have some room for "paid for" resource consumption.
+ */
+#define IDLE_LOAD_THRESHOLD 70
+
+/**
* @brief hello. A hello body contains the current HostAddress, the
* host identity (hash), the time how long the HostAddress is valid, a
* signature signing the information above and the public key of the
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2007-09-17 07:34:11 UTC (rev 5642)
+++ GNUnet/src/server/connection.c 2007-09-18 04:58:21 UTC (rev 5643)
@@ -75,16 +75,6 @@
#define STRICT_STAT_DOWN YES
/**
- * Until which load do we consider the peer overly idle
- * (which means that we would like to use more resources).<p>
- *
- * Note that we use 70 to leave some room for applications
- * to consume resources "idly" (i.e. up to 85%) and then
- * still have some room for "paid for" resource consumption.
- */
-#define IDLE_LOAD_THRESHOLD 70
-
-/**
* If an attempt to establish a connection is not answered
* within 150s, drop.
*/
@@ -1272,7 +1262,7 @@
msgCap = EXPECTED_MTU; /* have at least one MTU */
if (msgCap > max_bpm_up)
msgCap = max_bpm_up; /* have no more than max-bpm for entire daemon
*/
- if (load < 50)
+ if (load < IDLE_LOAD_THRESHOLD)
{ /* afford more if CPU load is low */
if (load == 0)
load = 1; /* avoid division by zero */
@@ -2753,7 +2743,7 @@
YES);
shutdownConnection (root);
}
- if ((root->consider_transport_switch == YES) && (load_cpu < 50))
+ if ((root->consider_transport_switch == YES) && (load_cpu <
IDLE_LOAD_THRESHOLD))
{
TSession *alternative;
@@ -3403,8 +3393,8 @@
max_bpm = new_max_bpm;
newMAXHOSTS = max_bpm / (MIN_BPM_PER_PEER * 4);
/* => for 1000 bps, we get 12 (rounded DOWN to 8) connections! */
- if (newMAXHOSTS < 8)
- newMAXHOSTS = 8; /* strict minimum is 8 (must, divided by 2,
match bootstrap.c!) */
+ if (newMAXHOSTS < MIN_CONNECTION_TARGET*2)
+ newMAXHOSTS = MIN_CONNECTION_TARGET*2;
if (newMAXHOSTS > 256)
newMAXHOSTS = 256; /* limit, otherwise we run out of sockets! */
Modified: GNUnet/src/util/os/statuscalls.c
===================================================================
--- GNUnet/src/util/os/statuscalls.c 2007-09-17 07:34:11 UTC (rev 5642)
+++ GNUnet/src/util/os/statuscalls.c 2007-09-18 04:58:21 UTC (rev 5643)
@@ -171,7 +171,6 @@
if (monitor->proc_net_dev != NULL)
{
rewind (monitor->proc_net_dev);
- fflush (monitor->proc_net_dev);
/* Parse the line matching the interface ('eth0') */
while (!feof (monitor->proc_net_dev))
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5643 - in GNUnet/src: applications/advertising applications/gap applications/session include server util/os,
gnunet <=