aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-xdht_neighbours.c
diff options
context:
space:
mode:
authorSupriti Singh <supritisingh08@gmail.com>2014-06-23 13:30:07 +0000
committerSupriti Singh <supritisingh08@gmail.com>2014-06-23 13:30:07 +0000
commit310b25e5a713d547aea2f34c76e7b3e35ded1ea5 (patch)
tree5d0bcc92b665f97dec9bbc8f8cb0c1e31718c6dc /src/dht/gnunet-service-xdht_neighbours.c
parent2ff52dabfadd9390d0751f9f9bdf463d76a80ec5 (diff)
downloadgnunet-310b25e5a713d547aea2f34c76e7b3e35ded1ea5.tar.gz
gnunet-310b25e5a713d547aea2f34c76e7b3e35ded1ea5.zip
-- New message type, GNUNET_MESSAGE_TYPE_XDHT_P2P_PUT and GNUNET_MESSAGE_TYPE_XDHT_P2P_GET
-- Changing name of all the messages of X-Vine by appending X in front of DHT. -- Not sending trail teardown in case next_hop or prev_hop is me (remove routing trail due to disconnected peer)
Diffstat (limited to 'src/dht/gnunet-service-xdht_neighbours.c')
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c101
1 files changed, 55 insertions, 46 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c
index f4ecbab38..7ce0473cf 100644
--- a/src/dht/gnunet-service-xdht_neighbours.c
+++ b/src/dht/gnunet-service-xdht_neighbours.c
@@ -75,6 +75,13 @@
75 * where a peer changes the value as we handle that case everywhere. s 75 * where a peer changes the value as we handle that case everywhere. s
76 */ 76 */
77/** 77/**
78 1. friend trails count in case it is finger, routing table trail
79 2. select_closest_peer in compare and update predecessor and successor,
80 update_predecessor.
81 */
82
83
84/**
78 * Maximum possible fingers (including predecessor) of a peer 85 * Maximum possible fingers (including predecessor) of a peer
79 */ 86 */
80#define MAX_FINGERS 65 87#define MAX_FINGERS 65
@@ -139,7 +146,7 @@ GNUNET_NETWORK_STRUCT_BEGIN
139struct PeerPutMessage 146struct PeerPutMessage
140{ 147{
141 /** 148 /**
142 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_PUT 149 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_PUT
143 */ 150 */
144 struct GNUNET_MessageHeader header; 151 struct GNUNET_MessageHeader header;
145 152
@@ -203,7 +210,7 @@ struct PeerPutMessage
203struct PeerGetMessage 210struct PeerGetMessage
204{ 211{
205 /** 212 /**
206 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_GET 213 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_GET
207 */ 214 */
208 struct GNUNET_MessageHeader header; 215 struct GNUNET_MessageHeader header;
209 216
@@ -260,7 +267,7 @@ struct PeerGetMessage
260struct PeerGetResultMessage 267struct PeerGetResultMessage
261{ 268{
262 /** 269 /**
263 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_GET_RESULT 270 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_GET_RESULT
264 */ 271 */
265 struct GNUNET_MessageHeader header; 272 struct GNUNET_MessageHeader header;
266 273
@@ -309,7 +316,7 @@ struct PeerGetResultMessage
309struct PeerTrailSetupMessage 316struct PeerTrailSetupMessage
310{ 317{
311 /** 318 /**
312 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP 319 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP
313 */ 320 */
314 struct GNUNET_MessageHeader header; 321 struct GNUNET_MessageHeader header;
315 322
@@ -359,7 +366,7 @@ struct PeerTrailSetupResultMessage
359{ 366{
360 367
361 /** 368 /**
362 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_RESULT 369 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP_RESULT
363 */ 370 */
364 struct GNUNET_MessageHeader header; 371 struct GNUNET_MessageHeader header;
365 372
@@ -401,7 +408,7 @@ struct PeerTrailSetupResultMessage
401struct PeerVerifySuccessorMessage 408struct PeerVerifySuccessorMessage
402{ 409{
403 /** 410 /**
404 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR 411 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_VERIFY_SUCCESSOR
405 */ 412 */
406 struct GNUNET_MessageHeader header; 413 struct GNUNET_MessageHeader header;
407 414
@@ -432,7 +439,7 @@ struct PeerVerifySuccessorMessage
432struct PeerVerifySuccessorResultMessage 439struct PeerVerifySuccessorResultMessage
433{ 440{
434 /** 441 /**
435 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR_RESULT 442 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_VERIFY_SUCCESSOR_RESULT
436 */ 443 */
437 struct GNUNET_MessageHeader header; 444 struct GNUNET_MessageHeader header;
438 445
@@ -475,7 +482,7 @@ struct PeerVerifySuccessorResultMessage
475struct PeerNotifyNewSuccessorMessage 482struct PeerNotifyNewSuccessorMessage
476{ 483{
477 /** 484 /**
478 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_NOTIFY_NEW_SUCCESSOR 485 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_NOTIFY_NEW_SUCCESSOR
479 */ 486 */
480 struct GNUNET_MessageHeader header; 487 struct GNUNET_MessageHeader header;
481 488
@@ -507,7 +514,7 @@ struct PeerNotifyNewSuccessorMessage
507struct PeerTrailCompressionMessage 514struct PeerTrailCompressionMessage
508{ 515{
509 /** 516 /**
510 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_COMPRESSION 517 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_COMPRESSION
511 */ 518 */
512 struct GNUNET_MessageHeader header; 519 struct GNUNET_MessageHeader header;
513 520
@@ -536,7 +543,7 @@ struct PeerTrailCompressionMessage
536struct PeerTrailTearDownMessage 543struct PeerTrailTearDownMessage
537{ 544{
538 /** 545 /**
539 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_TEARDOWN 546 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_TEARDOWN
540 */ 547 */
541 struct GNUNET_MessageHeader header; 548 struct GNUNET_MessageHeader header;
542 549
@@ -558,7 +565,7 @@ struct PeerTrailTearDownMessage
558struct PeerTrailRejectionMessage 565struct PeerTrailRejectionMessage
559{ 566{
560 /** 567 /**
561 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_REJECTION 568 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP_REJECTION
562 */ 569 */
563 struct GNUNET_MessageHeader header; 570 struct GNUNET_MessageHeader header;
564 571
@@ -604,7 +611,7 @@ struct PeerTrailRejectionMessage
604struct PeerAddTrailMessage 611struct PeerAddTrailMessage
605{ 612{
606 /** 613 /**
607 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_ADD_TRAIL 614 * Type: #GNUNET_MESSAGE_TYPE_XDHT_P2P_ADD_TRAIL
608 */ 615 */
609 struct GNUNET_MessageHeader header; 616 struct GNUNET_MessageHeader header;
610 617
@@ -1056,7 +1063,7 @@ GDS_NEIGHBOURS_send_trail_setup (struct GNUNET_PeerIdentity source_peer,
1056 tsm = (struct PeerTrailSetupMessage *) &pending[1]; 1063 tsm = (struct PeerTrailSetupMessage *) &pending[1];
1057 pending->msg = &tsm->header; 1064 pending->msg = &tsm->header;
1058 tsm->header.size = htons (msize); 1065 tsm->header.size = htons (msize);
1059 tsm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP); 1066 tsm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP);
1060 tsm->final_destination_finger_value = GNUNET_htonll (ultimate_destination_finger_value); 1067 tsm->final_destination_finger_value = GNUNET_htonll (ultimate_destination_finger_value);
1061 tsm->source_peer = source_peer; 1068 tsm->source_peer = source_peer;
1062 tsm->best_known_destination = best_known_destination; 1069 tsm->best_known_destination = best_known_destination;
@@ -1130,7 +1137,7 @@ GDS_NEIGHBOURS_send_trail_setup_result (struct GNUNET_PeerIdentity querying_peer
1130 tsrm = (struct PeerTrailSetupResultMessage *) &pending[1]; 1137 tsrm = (struct PeerTrailSetupResultMessage *) &pending[1];
1131 pending->msg = &tsrm->header; 1138 pending->msg = &tsrm->header;
1132 tsrm->header.size = htons (msize); 1139 tsrm->header.size = htons (msize);
1133 tsrm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_RESULT); 1140 tsrm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP_RESULT);
1134 tsrm->querying_peer = querying_peer; 1141 tsrm->querying_peer = querying_peer;
1135 tsrm->finger_identity = finger; 1142 tsrm->finger_identity = finger;
1136 tsrm->is_predecessor = htonl (is_predecessor); 1143 tsrm->is_predecessor = htonl (is_predecessor);
@@ -1201,7 +1208,7 @@ GDS_NEIGHBOURS_send_trail_rejection (struct GNUNET_PeerIdentity source_peer,
1201 trm = (struct PeerTrailRejectionMessage *)&pending[1]; 1208 trm = (struct PeerTrailRejectionMessage *)&pending[1];
1202 pending->msg = &trm->header; 1209 pending->msg = &trm->header;
1203 trm->header.size = htons (msize); 1210 trm->header.size = htons (msize);
1204 trm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_REJECTION); 1211 trm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP_REJECTION);
1205 trm->source_peer = source_peer; 1212 trm->source_peer = source_peer;
1206 trm->congested_peer = congested_peer; 1213 trm->congested_peer = congested_peer;
1207 trm->congestion_time = congestion_timeout; 1214 trm->congestion_time = congestion_timeout;
@@ -1265,7 +1272,7 @@ GDS_NEIGHBOURS_send_verify_successor_message (struct GNUNET_PeerIdentity source_
1265 vsm = (struct PeerVerifySuccessorMessage *) &pending[1]; 1272 vsm = (struct PeerVerifySuccessorMessage *) &pending[1];
1266 pending->msg = &vsm->header; 1273 pending->msg = &vsm->header;
1267 vsm->header.size = htons (msize); 1274 vsm->header.size = htons (msize);
1268 vsm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR); 1275 vsm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_VERIFY_SUCCESSOR);
1269 vsm->source_peer = source_peer; 1276 vsm->source_peer = source_peer;
1270 vsm->successor = successor; 1277 vsm->successor = successor;
1271 vsm->trail_id = trail_id; 1278 vsm->trail_id = trail_id;
@@ -1326,7 +1333,7 @@ GDS_NEIGHBOURS_send_trail_teardown (struct GNUNET_HashCode trail_id,
1326 ttdm = (struct PeerTrailTearDownMessage *) &pending[1]; 1333 ttdm = (struct PeerTrailTearDownMessage *) &pending[1];
1327 pending->msg = &ttdm->header; 1334 pending->msg = &ttdm->header;
1328 ttdm->header.size = htons (msize); 1335 ttdm->header.size = htons (msize);
1329 ttdm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_TEARDOWN); 1336 ttdm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_TEARDOWN);
1330 ttdm->trail_id = trail_id; 1337 ttdm->trail_id = trail_id;
1331 ttdm->trail_direction = htonl (trail_direction); 1338 ttdm->trail_direction = htonl (trail_direction);
1332 1339
@@ -1389,7 +1396,7 @@ GDS_NEIGHBOURS_send_verify_successor_result (struct GNUNET_PeerIdentity querying
1389 vsmr = (struct PeerVerifySuccessorResultMessage *) &pending[1]; 1396 vsmr = (struct PeerVerifySuccessorResultMessage *) &pending[1];
1390 pending->msg = &vsmr->header; 1397 pending->msg = &vsmr->header;
1391 vsmr->header.size = htons (msize); 1398 vsmr->header.size = htons (msize);
1392 vsmr->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR_RESULT); 1399 vsmr->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_VERIFY_SUCCESSOR_RESULT);
1393 vsmr->querying_peer = querying_peer; 1400 vsmr->querying_peer = querying_peer;
1394 vsmr->current_successor = current_successor; 1401 vsmr->current_successor = current_successor;
1395 vsmr->probable_successor = probable_successor; 1402 vsmr->probable_successor = probable_successor;
@@ -1455,7 +1462,7 @@ GDS_NEIGHBOURS_send_notify_new_successor (struct GNUNET_PeerIdentity source_peer
1455 nsm = (struct PeerNotifyNewSuccessorMessage *) &pending[1]; 1462 nsm = (struct PeerNotifyNewSuccessorMessage *) &pending[1];
1456 pending->msg = &nsm->header; 1463 pending->msg = &nsm->header;
1457 nsm->header.size = htons (msize); 1464 nsm->header.size = htons (msize);
1458 nsm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_NOTIFY_NEW_SUCCESSOR); 1465 nsm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_NOTIFY_NEW_SUCCESSOR);
1459 nsm->new_successor = successor; 1466 nsm->new_successor = successor;
1460 nsm->source_peer = source_peer; 1467 nsm->source_peer = source_peer;
1461 nsm->trail_id = succesor_trail_id; 1468 nsm->trail_id = succesor_trail_id;
@@ -1519,7 +1526,7 @@ GDS_NEIGHBOURS_send_add_trail (struct GNUNET_PeerIdentity source_peer,
1519 adm = (struct PeerAddTrailMessage *) &pending[1]; 1526 adm = (struct PeerAddTrailMessage *) &pending[1];
1520 pending->msg = &adm->header; 1527 pending->msg = &adm->header;
1521 adm->header.size = htons (msize); 1528 adm->header.size = htons (msize);
1522 adm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_ADD_TRAIL); 1529 adm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_ADD_TRAIL);
1523 adm->source_peer = source_peer; 1530 adm->source_peer = source_peer;
1524 adm->destination_peer = destination_peer; 1531 adm->destination_peer = destination_peer;
1525 adm->trail_id = trail_id; 1532 adm->trail_id = trail_id;
@@ -1573,7 +1580,7 @@ GDS_NEIGHBOURS_send_trail_compression (struct GNUNET_PeerIdentity source_peer,
1573 tcm = (struct PeerTrailCompressionMessage *) &pending[1]; 1580 tcm = (struct PeerTrailCompressionMessage *) &pending[1];
1574 pending->msg = &tcm->header; 1581 pending->msg = &tcm->header;
1575 tcm->header.size = htons (msize); 1582 tcm->header.size = htons (msize);
1576 tcm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_COMPRESSION); 1583 tcm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_COMPRESSION);
1577 tcm->source_peer = source_peer; 1584 tcm->source_peer = source_peer;
1578 tcm->new_first_friend = first_friend; 1585 tcm->new_first_friend = first_friend;
1579 tcm->trail_id = trail_id; 1586 tcm->trail_id = trail_id;
@@ -2134,7 +2141,7 @@ GDS_NEIGHBOURS_send_put (const struct GNUNET_HashCode *key,
2134 ppm = (struct PeerPutMessage *) &pending[1]; 2141 ppm = (struct PeerPutMessage *) &pending[1];
2135 pending->msg = &ppm->header; 2142 pending->msg = &ppm->header;
2136 ppm->header.size = htons (msize); 2143 ppm->header.size = htons (msize);
2137 ppm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_PUT); 2144 ppm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_PUT);
2138 ppm->options = htonl (options); 2145 ppm->options = htonl (options);
2139 ppm->block_type = htonl (block_type); 2146 ppm->block_type = htonl (block_type);
2140 ppm->hop_count = htonl (hop_count + 1); 2147 ppm->hop_count = htonl (hop_count + 1);
@@ -2252,7 +2259,7 @@ GDS_NEIGHBOURS_send_get (const struct GNUNET_HashCode *key,
2252 pgm = (struct PeerGetMessage *) &pending[1]; 2259 pgm = (struct PeerGetMessage *) &pending[1];
2253 pending->msg = &pgm->header; 2260 pending->msg = &pgm->header;
2254 pgm->header.size = htons (msize); 2261 pgm->header.size = htons (msize);
2255 pgm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_GET); 2262 pgm->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_GET);
2256 pgm->get_path_length = htonl (get_path_length); 2263 pgm->get_path_length = htonl (get_path_length);
2257 pgm->best_known_destination = local_best_known_dest; 2264 pgm->best_known_destination = local_best_known_dest;
2258 2265
@@ -2339,7 +2346,7 @@ GDS_NEIGHBOURS_send_get_result (const struct GNUNET_HashCode *key,
2339 get_result = (struct PeerGetResultMessage *)&pending[1]; 2346 get_result = (struct PeerGetResultMessage *)&pending[1];
2340 pending->msg = &get_result->header; 2347 pending->msg = &get_result->header;
2341 get_result->header.size = htons (msize); 2348 get_result->header.size = htons (msize);
2342 get_result->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_GET_RESULT); 2349 get_result->header.type = htons (GNUNET_MESSAGE_TYPE_XDHT_P2P_GET_RESULT);
2343 get_result->key = *key; 2350 get_result->key = *key;
2344 /* FIXME: check if you are passing the correct querying_peer as described in 2351 /* FIXME: check if you are passing the correct querying_peer as described in
2345 the get_result documentation. */ 2352 the get_result documentation. */
@@ -2693,12 +2700,12 @@ send_trail_teardown (struct FingerInfo *finger,
2693 then remove finger. */ 2700 then remove finger. */
2694 /* We should decerement the friend trail count here. */ 2701 /* We should decerement the friend trail count here. */
2695 struct FriendInfo *friend; 2702 struct FriendInfo *friend;
2696 2703
2697 GNUNET_assert (NULL != (friend = 2704 GNUNET_assert (NULL != (friend =
2698 GNUNET_CONTAINER_multipeermap_get (friend_peermap, 2705 GNUNET_CONTAINER_multipeermap_get (friend_peermap,
2699 &trail->trail_head->peer))); 2706 &trail->trail_head->peer)));
2700 2707
2701 friend->trails_count--; 2708 //friend->trails_count--;
2702 GDS_NEIGHBOURS_send_trail_teardown (trail->trail_id, 2709 GDS_NEIGHBOURS_send_trail_teardown (trail->trail_id,
2703 GDS_ROUTING_SRC_TO_DEST, 2710 GDS_ROUTING_SRC_TO_DEST,
2704 &trail->trail_head->peer); 2711 &trail->trail_head->peer);
@@ -3304,7 +3311,7 @@ finger_table_add (struct GNUNET_PeerIdentity finger_identity,
3304 add_new_finger (finger_identity, updated_trail, updated_finger_trail_length, 3311 add_new_finger (finger_identity, updated_trail, updated_finger_trail_length,
3305 finger_trail_id, finger_table_index); 3312 finger_trail_id, finger_table_index);
3306 update_current_search_finger_index (finger_identity, finger_table_index); 3313 update_current_search_finger_index (finger_identity, finger_table_index);
3307 GNUNET_free (updated_trail); 3314 GNUNET_free_non_null (updated_trail);
3308 return; 3315 return;
3309 } 3316 }
3310 3317
@@ -3330,7 +3337,7 @@ finger_table_add (struct GNUNET_PeerIdentity finger_identity,
3330 if (0 == GNUNET_CRYPTO_cmp_peer_identity (&(existing_finger->finger_identity), 3337 if (0 == GNUNET_CRYPTO_cmp_peer_identity (&(existing_finger->finger_identity),
3331 &my_identity)) 3338 &my_identity))
3332 { 3339 {
3333 GNUNET_free (updated_trail); 3340 GNUNET_free_non_null (updated_trail);
3334 return; 3341 return;
3335 } 3342 }
3336 /* If the existing finger is not a friend. */ 3343 /* If the existing finger is not a friend. */
@@ -3348,7 +3355,7 @@ finger_table_add (struct GNUNET_PeerIdentity finger_identity,
3348 } 3355 }
3349 } 3356 }
3350 update_current_search_finger_index (finger_identity, finger_table_index); 3357 update_current_search_finger_index (finger_identity, finger_table_index);
3351 GNUNET_free (updated_trail); 3358 GNUNET_free_non_null (updated_trail);
3352 return; 3359 return;
3353} 3360}
3354 3361
@@ -3502,6 +3509,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
3502 GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time), 3509 GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time),
3503 &(put->key),putlen, pp, ntohl (put->block_type), 3510 &(put->key),putlen, pp, ntohl (put->block_type),
3504 payload_size, payload); 3511 payload_size, payload);
3512 GNUNET_free_non_null (next_hop);
3505 return GNUNET_YES; 3513 return GNUNET_YES;
3506 } 3514 }
3507 else 3515 else
@@ -3855,8 +3863,7 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer,
3855 &my_identity))) 3863 &my_identity)))
3856 { 3864 {
3857 /* If I was not the source of this message for which now I am destination */ 3865 /* If I was not the source of this message for which now I am destination */
3858 if ((0 != GNUNET_CRYPTO_cmp_peer_identity (&source, &my_identity)) || 3866 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&source, &my_identity))
3859 (trail_length > 0))
3860 { 3867 {
3861 GDS_ROUTING_add (trail_id, *peer, my_identity); 3868 GDS_ROUTING_add (trail_id, *peer, my_identity);
3862 } 3869 }
@@ -4991,6 +4998,7 @@ handle_dht_p2p_trail_teardown (void *cls, const struct GNUNET_PeerIdentity *peer
4991 struct GNUNET_PeerIdentity *next_hop; 4998 struct GNUNET_PeerIdentity *next_hop;
4992 size_t msize; 4999 size_t msize;
4993 msize = ntohs (message->size); 5000 msize = ntohs (message->size);
5001
4994 /* Here we pass only the trail id. */ 5002 /* Here we pass only the trail id. */
4995 if (msize != sizeof (struct PeerTrailTearDownMessage)) 5003 if (msize != sizeof (struct PeerTrailTearDownMessage))
4996 { 5004 {
@@ -5136,7 +5144,7 @@ remove_matching_trails (const struct GNUNET_PeerIdentity *disconnected_friend,
5136 /* Number of trails with disconnected_friend as the first hop in the trail 5144 /* Number of trails with disconnected_friend as the first hop in the trail
5137 * to reach from me to remove_finger, NOT including endpoints. */ 5145 * to reach from me to remove_finger, NOT including endpoints. */
5138 matching_trails_count = 0; 5146 matching_trails_count = 0;
5139 5147
5140 /* Iterate over all the trails of finger. */ 5148 /* Iterate over all the trails of finger. */
5141 for (i = 0; i < remove_finger->trails_count; i++) 5149 for (i = 0; i < remove_finger->trails_count; i++)
5142 { 5150 {
@@ -5329,6 +5337,7 @@ core_init (void *cls,
5329 FPRINTF (stderr,_("\nSUPU %s, %s, %d, my_identity = %s"), 5337 FPRINTF (stderr,_("\nSUPU %s, %s, %d, my_identity = %s"),
5330 __FILE__, __func__,__LINE__, GNUNET_i2s (&my_identity)); 5338 __FILE__, __func__,__LINE__, GNUNET_i2s (&my_identity));
5331#endif 5339#endif
5340
5332} 5341}
5333 5342
5334 5343
@@ -5360,20 +5369,20 @@ int
5360GDS_NEIGHBOURS_init (void) 5369GDS_NEIGHBOURS_init (void)
5361{ 5370{
5362 static struct GNUNET_CORE_MessageHandler core_handlers[] = { 5371 static struct GNUNET_CORE_MessageHandler core_handlers[] = {
5363 {&handle_dht_p2p_put, GNUNET_MESSAGE_TYPE_DHT_P2P_PUT, 0}, 5372 {&handle_dht_p2p_put, GNUNET_MESSAGE_TYPE_XDHT_P2P_PUT, 0},
5364 {&handle_dht_p2p_get, GNUNET_MESSAGE_TYPE_DHT_P2P_GET, 0}, 5373 {&handle_dht_p2p_get, GNUNET_MESSAGE_TYPE_XDHT_P2P_GET, 0},
5365 {&handle_dht_p2p_get_result, GNUNET_MESSAGE_TYPE_DHT_P2P_GET_RESULT, 0}, 5374 {&handle_dht_p2p_get_result, GNUNET_MESSAGE_TYPE_XDHT_P2P_GET_RESULT, 0},
5366 {&handle_dht_p2p_trail_setup, GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP, 0}, 5375 {&handle_dht_p2p_trail_setup, GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP, 0},
5367 {&handle_dht_p2p_trail_setup_result, GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_RESULT, 0}, 5376 {&handle_dht_p2p_trail_setup_result, GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP_RESULT, 0},
5368 {&handle_dht_p2p_verify_successor, GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR, 0}, 5377 {&handle_dht_p2p_verify_successor, GNUNET_MESSAGE_TYPE_XDHT_P2P_VERIFY_SUCCESSOR, 0},
5369 {&handle_dht_p2p_verify_successor_result, GNUNET_MESSAGE_TYPE_DHT_P2P_VERIFY_SUCCESSOR_RESULT, 0}, 5378 {&handle_dht_p2p_verify_successor_result, GNUNET_MESSAGE_TYPE_XDHT_P2P_VERIFY_SUCCESSOR_RESULT, 0},
5370 {&handle_dht_p2p_notify_new_successor, GNUNET_MESSAGE_TYPE_DHT_P2P_NOTIFY_NEW_SUCCESSOR, 0}, 5379 {&handle_dht_p2p_notify_new_successor, GNUNET_MESSAGE_TYPE_XDHT_P2P_NOTIFY_NEW_SUCCESSOR, 0},
5371 {&handle_dht_p2p_trail_setup_rejection, GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_REJECTION, 0}, 5380 {&handle_dht_p2p_trail_setup_rejection, GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_SETUP_REJECTION, 0},
5372 {&handle_dht_p2p_trail_compression, GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_COMPRESSION, 5381 {&handle_dht_p2p_trail_compression, GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_COMPRESSION,
5373 sizeof (struct PeerTrailCompressionMessage)}, 5382 sizeof (struct PeerTrailCompressionMessage)},
5374 {&handle_dht_p2p_trail_teardown, GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_TEARDOWN, 5383 {&handle_dht_p2p_trail_teardown, GNUNET_MESSAGE_TYPE_XDHT_P2P_TRAIL_TEARDOWN,
5375 sizeof (struct PeerTrailTearDownMessage)}, 5384 sizeof (struct PeerTrailTearDownMessage)},
5376 {&handle_dht_p2p_add_trail, GNUNET_MESSAGE_TYPE_DHT_P2P_ADD_TRAIL, 0}, 5385 {&handle_dht_p2p_add_trail, GNUNET_MESSAGE_TYPE_XDHT_P2P_ADD_TRAIL, 0},
5377 {NULL, 0, 0} 5386 {NULL, 0, 0}
5378 }; 5387 };
5379 5388