From 1c566a6cf35df66afb22b9516e408b2fdc2ff85d Mon Sep 17 00:00:00 2001 From: Supriti Singh Date: Fri, 22 Aug 2014 11:20:31 +0000 Subject: Handling missing next hop in verify successor --- src/dht/gnunet-service-xdht_neighbours.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index 08ed33ce7..f0a1cb8b9 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c @@ -4684,10 +4684,29 @@ handle_dht_p2p_verify_successor(void *cls, next_hop = GDS_ROUTING_get_next_hop (trail_id, GDS_ROUTING_SRC_TO_DEST); if (NULL == next_hop) { - DEBUG(" NO ENTRY FOUND IN %s ROUTING TABLE for trail id %s, line", - GNUNET_i2s(&my_identity), GNUNET_h2s(&trail_id), __LINE__); - GNUNET_break_op (0); - return GNUNET_OK; + //SUPUs anyways you are passing the trail, just do the lookup + // and pass the message forward. + int my_index = search_my_index (trail, trail_length); + if(-1 == my_index) + { + DEBUG(" Peer %s not present in trail id %s, line =%d", + GNUNET_i2s(&my_identity), GNUNET_h2s(&trail_id), __LINE__); + GNUNET_break_op (0); + return GNUNET_OK; + } + if((my_index == trail_length + 1)) + { + DEBUG(" Peer %s present twice in trail id %s, line =%d", + GNUNET_i2s(&my_identity), GNUNET_h2s(&trail_id), __LINE__); + GNUNET_break_op (0); + return GNUNET_OK; + } + if(my_index == (trail_length - 1)) + { + *next_hop = successor; + } + else + *next_hop = trail[my_index + 1]; } target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, next_hop); -- cgit v1.2.3