From: Christian Grothoff Date: Sat, 17 Apr 2010 21:16:41 +0000 (+0000) Subject: proper HELLO merging X-Git-Tag: initial-import-from-subversion-38251~22104 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=967418d0b309a8efb8d552ced8359bfe2d444e45;p=oweals%2Fgnunet.git proper HELLO merging --- diff --git a/TODO b/TODO index b7b1441b7..bca489b25 100644 --- a/TODO +++ b/TODO @@ -1,17 +1,14 @@ 0.9.0pre1: -* PEERINFO: +* PEERINFO: [CG] - trust: need *fast* way to check/update trust in peers (async peerinfo would not be right; certainly not with the current API) -* TOPOLOGY: - - check if new HELLO learned is different from old HELLO - before resetting entire state! - - needs more testing (especially F2F topology) +* 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 'blacklist_after_attempt' being set to 1h, + 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) + 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 @@ -24,9 +21,7 @@ a minor issue; OTOH, we might want to be more explicit about allowing/forbidding connects on pre-connect to avoid entering connect attempts to just be blacklisted shortly afterwards). -* DATASTORE: - - API lacks cancellation methods (needed? or is disconnect enough?) - - may also want to integrate request queuing here instead of gnunet-service-fs_drq.c + - needs more testing (especially F2F topology) * FS: [CG] - support recursive download even if filename is NULL and we hence do not generate files on disk (use temp_filename) @@ -180,10 +175,6 @@ Optimizations: * TCP: - should use hash map to look up sessions -* PEERINFO: - - api creates many, many short-lived TCP connections; either some - clients should use the API differently or we need to change the - API to enable re-use of connections to the service * STATISTICS: - should use BIO instead of mmap * TRANSPORT: @@ -196,7 +187,7 @@ Optimizations: - should use hash map to look up Neighbours * HOSTLIST: - 'server' uses 'GNUNET_PEERINFO_iterate', should probably switch to notification API - (for more instant / up-to-date hostlists at lower cost) [OPTIMIZATION] + (for more instant / up-to-date hostlists at lower cost) * DATASTORE (?): - check for duplicates on insertion (currently, same content is frequently stored again [seen with KBLOCKS and SBLOCKS]!) diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 3aa518fa1..3a2a421d4 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c @@ -1016,6 +1016,8 @@ consider_for_advertising (const struct GNUNET_HELLO_Message *hello) { int have_address; struct GNUNET_PeerIdentity pid; + struct GNUNET_TIME_Absolute dt; + struct GNUNET_HELLO_Message *nh; struct Peer *peer; uint16_t size; @@ -1034,17 +1036,36 @@ consider_for_advertising (const struct GNUNET_HELLO_Message *hello) peer = GNUNET_CONTAINER_multihashmap_get (peers, &pid.hashPubKey); if (peer == NULL) - peer = make_peer (&pid, hello, GNUNET_NO); + { + peer = make_peer (&pid, hello, GNUNET_NO); + } + else if (peer->hello != NULL) + { + dt = GNUNET_HELLO_equals (peer->hello, + hello, + GNUNET_TIME_absolute_get()); + if (dt.value == GNUNET_TIME_UNIT_FOREVER_ABS.value) + return; /* nothing new here */ + } #if DEBUG_TOPOLOGY GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found `%s' from peer `%s' for advertising\n", "HELLO", GNUNET_i2s (&pid)); #endif - size = GNUNET_HELLO_size (hello); - GNUNET_free_non_null (peer->hello); - peer->hello = GNUNET_malloc (size); - memcpy (peer->hello, hello, size); + if (peer->hello != NULL) + { + nh = GNUNET_HELLO_merge (peer->hello, + hello); + GNUNET_free (peer->hello); + peer->hello = nh; + } + else + { + size = GNUNET_HELLO_size (hello); + peer->hello = GNUNET_malloc (size); + memcpy (peer->hello, hello, size); + } if (peer->filter != NULL) GNUNET_CONTAINER_bloomfilter_free (peer->filter); setup_filter (peer);