[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10969 - in gnunet: . src/topology
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10969 - in gnunet: . src/topology |
Date: |
Sun, 18 Apr 2010 00:54:36 +0200 |
Author: grothoff
Date: 2010-04-18 00:54:36 +0200 (Sun, 18 Apr 2010)
New Revision: 10969
Modified:
gnunet/TODO
gnunet/src/topology/gnunet-daemon-topology.c
Log:
use back-off and higher-frequency re-tries to start with for creating
connections
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-04-17 21:16:41 UTC (rev 10968)
+++ gnunet/TODO 2010-04-17 22:54:36 UTC (rev 10969)
@@ -3,12 +3,6 @@
- trust: need *fast* way to check/update trust in peers
(async peerinfo would not be right; certainly not with the current
API)
* TOPOLOGY: [CG]
- - needs to re-try connecting after disconnect (currently, it
- initially triggers a connection request, but if that connection
- fails / goes down, it does not retry in a timely fashion;
- cause seems to be the 'greylist_after_attempt' being set to 1h,
- which is rather long -- and should probably be adjusted based on
- the number of connections / known peers & use some form of back-off)
- If the topology daemon crashes, peers that were put on the
blacklist with transport will never be removed from it (until
transport service dies); we should use the blacklist notification
Modified: gnunet/src/topology/gnunet-daemon-topology.c
===================================================================
--- gnunet/src/topology/gnunet-daemon-topology.c 2010-04-17 21:16:41 UTC
(rev 10968)
+++ gnunet/src/topology/gnunet-daemon-topology.c 2010-04-17 22:54:36 UTC
(rev 10969)
@@ -41,15 +41,27 @@
* For how long do we blacklist a peer after a failed connection
* attempt?
*/
-#define GREYLIST_AFTER_ATTEMPT GNUNET_TIME_UNIT_HOURS
+#define GREYLIST_AFTER_ATTEMPT GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 15)
/**
* For how long do we blacklist a friend after a failed connection
* attempt?
*/
-#define GREYLIST_AFTER_ATTEMPT_FRIEND GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 15)
+#define GREYLIST_AFTER_ATTEMPT_FRIEND GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 2)
/**
+ * For how long do we blacklist anyone under any cirumstances after a failed
connection
+ * attempt?
+ */
+#define GREYLIST_AFTER_ATTEMPT_MIN GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 15)
+
+/**
+ * For how long do we blacklist anyone under any cirumstances after a failed
connection
+ * attempt?
+ */
+#define GREYLIST_AFTER_ATTEMPT_MAX GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_HOURS, 18)
+
+/**
* How often do we at most advertise any HELLO to a peer?
*/
#define HELLO_ADVERTISEMENT_MIN_FREQUENCY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_HOURS, 4)
@@ -127,6 +139,11 @@
GNUNET_SCHEDULER_TaskIdentifier greylist_clean_task;
/**
+ * How often have we tried so far?
+ */
+ unsigned int connect_attempts;
+
+ /**
* Is this peer listed here because he is a friend?
*/
int is_friend;
@@ -512,7 +529,15 @@
rem = GREYLIST_AFTER_ATTEMPT_FRIEND;
else
rem = GREYLIST_AFTER_ATTEMPT;
- /* FIXME: do exponential back-off? */
+ rem = GNUNET_TIME_relative_multiply (rem, connection_count);
+ rem = GNUNET_TIME_relative_divide (rem, target_connection_count);
+ if (pos->connect_attempts > 30)
+ pos->connect_attempts = 30;
+ rem = GNUNET_TIME_relative_multiply (rem, 1 << (++pos->connect_attempts));
+ rem = GNUNET_TIME_relative_max (rem,
+ GREYLIST_AFTER_ATTEMPT_MIN);
+ rem = GNUNET_TIME_relative_min (rem,
+ GREYLIST_AFTER_ATTEMPT_MAX);
pos->greylisted_until = GNUNET_TIME_relative_to_absolute (rem);
if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (sched,
@@ -857,6 +882,7 @@
pos->greylisted_until.value = 0; /* remove greylisting */
}
pos->is_connected = GNUNET_YES;
+ pos->connect_attempts = 0; /* re-set back-off factor */
if (pos->is_friend)
{
if ( (friend_count == minimum_friend_count - 1) &&
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10969 - in gnunet: . src/topology,
gnunet <=