From 3a97e98e8036bf1652562715b4b4bff4193efb4e Mon Sep 17 00:00:00 2001 From: Supriti Singh Date: Wed, 20 Aug 2014 09:17:55 +0000 Subject: xvine: fixes --- src/dht/gnunet-service-xdht_neighbours.c | 61 +++++++++++++++++++------------- 1 file changed, 37 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index f42819aa5..b13c7bc3c 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c @@ -75,12 +75,12 @@ /** * How long to wait before sending another find finger trail request */ -#define DHT_FIND_FINGER_TRAIL_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 50) +#define DHT_FIND_FINGER_TRAIL_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500) /** * How long to wait before sending another verify successor message. */ -#define DHT_SEND_VERIFY_SUCCESSOR_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 5) +#define DHT_SEND_VERIFY_SUCCESSOR_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 60) /** * How long at most to wait for transmission of a request to a friend ? @@ -3499,7 +3499,29 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, return GNUNET_OK; } } - + + /* Check if you are already a part of put path. */ + unsigned int i; + for (i = 0; i < putlen; i++) + { + if(0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &put_path[i])) + { + putlen = i; + break; + } + } + + /* Add yourself to the list. */ + struct GNUNET_PeerIdentity pp[putlen + 1]; + if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) + { + memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity)); + pp[putlen] = my_identity; + putlen++; + } + else + putlen = 0; + memcpy (&key_value, &(put->key), sizeof (uint64_t)); if (0 != (GNUNET_CRYPTO_cmp_peer_identity (&best_known_dest, &my_identity))) { @@ -3513,9 +3535,20 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, gettext_noop ("# Next hop to forward the packet not found " "trail setup request, packet dropped."), 1, GNUNET_NO); + GNUNET_break_op (0); + //FIXME: Adding put here,only to ensure that process does not hang. but + // should not be here. fix the logic. + GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time), + &(put->key),putlen, pp, ntohl (put->block_type), + payload_size, payload); return GNUNET_OK; } + else + { + GNUNET_assert (0 != GNUNET_CRYPTO_cmp_peer_identity (&my_identity, + next_hop)); + } } else { @@ -3528,27 +3561,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, best_known_dest = successor.best_known_destination; } - /* Check if you are already a part of put path. */ - unsigned int i; - for (i = 0; i < putlen; i++) - { - if(0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &put_path[i])) - { - putlen = i; - break; - } - } - - /* Add yourself to the list. */ - struct GNUNET_PeerIdentity pp[putlen + 1]; - if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) - { - memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity)); - pp[putlen] = my_identity; - putlen++; - } - else - putlen = 0; + GDS_CLIENTS_process_put (options, ntohl (put->block_type), -- cgit v1.2.3