summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSupriti Singh <supritisingh08@gmail.com>2014-08-22 11:20:31 +0000
committerSupriti Singh <supritisingh08@gmail.com>2014-08-22 11:20:31 +0000
commit1c566a6cf35df66afb22b9516e408b2fdc2ff85d (patch)
treeff4f2492b6cc8cf8c862ebf8b2f4f40ebaf68ec6 /src
parentcf537e4faf48ae5c99d5dccb27fa628dd1df02c6 (diff)
Handling missing next hop in verify successor
Diffstat (limited to 'src')
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c27
1 files changed, 23 insertions, 4 deletions
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);