aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorSupriti Singh <supritisingh08@gmail.com>2014-05-13 15:02:42 +0000
committerSupriti Singh <supritisingh08@gmail.com>2014-05-13 15:02:42 +0000
commita4e4b3b987575921eb50ab007234bc68d4c96acb (patch)
tree8a9f477afc1b8890189ec53a6b9a747e4f1f5e29 /src/dht
parent745aec69ca5f28d1db95f3add161c0690f25cc32 (diff)
downloadgnunet-a4e4b3b987575921eb50ab007234bc68d4c96acb.tar.gz
gnunet-a4e4b3b987575921eb50ab007234bc68d4c96acb.zip
Handling the correct return type from find_successor() in get,put,get_result functions.
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-service-xdht_clients.c14
-rw-r--r--src/dht/gnunet-service-xdht_datacache.c19
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c105
3 files changed, 67 insertions, 71 deletions
diff --git a/src/dht/gnunet-service-xdht_clients.c b/src/dht/gnunet-service-xdht_clients.c
index 453fe38ab..3da483ae7 100644
--- a/src/dht/gnunet-service-xdht_clients.c
+++ b/src/dht/gnunet-service-xdht_clients.c
@@ -918,7 +918,7 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client,
918 struct PendingMessage *pm; 918 struct PendingMessage *pm;
919 struct GNUNET_DHT_ClientPutConfirmationMessage *conf; 919 struct GNUNET_DHT_ClientPutConfirmationMessage *conf;
920 uint16_t size; 920 uint16_t size;
921 FPRINTF (stderr,_("\nSUPU %s, %s, %d"),__FILE__, __func__,__LINE__); 921
922 size = ntohs (message->size); 922 size = ntohs (message->size);
923 if (size < sizeof (struct GNUNET_DHT_ClientPutMessage)) 923 if (size < sizeof (struct GNUNET_DHT_ClientPutMessage))
924 { 924 {
@@ -931,7 +931,7 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client,
931 ("# PUT requests received from clients"), 1, 931 ("# PUT requests received from clients"), 1,
932 GNUNET_NO); 932 GNUNET_NO);
933 put_msg = (const struct GNUNET_DHT_ClientPutMessage *) message; 933 put_msg = (const struct GNUNET_DHT_ClientPutMessage *) message;
934 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "R5N CLIENT-PUT %s\n", 934 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "X-VINE DHT CLIENT-PUT %s\n",
935 GNUNET_h2s_full (&put_msg->key)); 935 GNUNET_h2s_full (&put_msg->key));
936 /* give to local clients */ 936 /* give to local clients */
937 LOG (GNUNET_ERROR_TYPE_DEBUG, 937 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -949,14 +949,8 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client,
949 &put_msg->key, 0, NULL, ntohl (put_msg->type), 949 &put_msg->key, 0, NULL, ntohl (put_msg->type),
950 size - sizeof (struct GNUNET_DHT_ClientPutMessage), 950 size - sizeof (struct GNUNET_DHT_ClientPutMessage),
951 &put_msg[1]); 951 &put_msg[1]);
952 952
953 /* FIXME: Is it correct to pass your identity as default current_destination 953 struct GNUNET_PeerIdentity my_identity = GDS_NEIGHBOURS_get_my_id();
954 * and current_source. also is it correct to copy your identity into a new
955 * address and then pass this address. address at which your identity is
956 * stored should be const or else you may overwrite it and you lose your
957 * identity value. */
958 struct GNUNET_PeerIdentity my_identity;
959 my_identity = GDS_NEIGHBOURS_get_my_id();
960 GDS_NEIGHBOURS_send_put (&put_msg->key, &put_msg[1], 954 GDS_NEIGHBOURS_send_put (&put_msg->key, &put_msg[1],
961 size - sizeof (struct GNUNET_DHT_ClientPutMessage), 955 size - sizeof (struct GNUNET_DHT_ClientPutMessage),
962 ntohl (put_msg->type), ntohl (put_msg->options), 956 ntohl (put_msg->type), ntohl (put_msg->options),
diff --git a/src/dht/gnunet-service-xdht_datacache.c b/src/dht/gnunet-service-xdht_datacache.c
index e741b02e7..b679f28a6 100644
--- a/src/dht/gnunet-service-xdht_datacache.c
+++ b/src/dht/gnunet-service-xdht_datacache.c
@@ -310,16 +310,19 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
310 310
311 /* FIXME: add the get path into ctx and then call gds_neighbours_handle_get*/ 311 /* FIXME: add the get path into ctx and then call gds_neighbours_handle_get*/
312 int i = 0; 312 int i = 0;
313 while (i < get_path_length) 313 if(get_path != NULL)
314 { 314 {
315 struct GetPath *element; 315 while (i < get_path_length)
316 element = GNUNET_malloc (sizeof (struct GetPath)); 316 {
317 element->next = NULL; 317 struct GetPath *element;
318 element->prev = NULL; 318 element = GNUNET_malloc (sizeof (struct GetPath));
319 element->next = NULL;
320 element->prev = NULL;
319 321
320 memcpy (&(element->peer), &get_path[i], sizeof(struct GNUNET_PeerIdentity)); 322 memcpy (&(element->peer), &get_path[i], sizeof(struct GNUNET_PeerIdentity));
321 GNUNET_CONTAINER_DLL_insert_tail(ctx.head, ctx.tail, element); 323 GNUNET_CONTAINER_DLL_insert_tail(ctx.head, ctx.tail, element);
322 i++; 324 i++;
325 }
323 } 326 }
324 327
325 r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, 328 r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator,
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c
index 22b4d55c3..00b4580c7 100644
--- a/src/dht/gnunet-service-xdht_neighbours.c
+++ b/src/dht/gnunet-service-xdht_neighbours.c
@@ -1607,7 +1607,7 @@ scan_and_compress_trail (struct GNUNET_PeerIdentity *trail,
1607{ 1607{
1608 int i; 1608 int i;
1609 struct FriendInfo *target_friend; 1609 struct FriendInfo *target_friend;
1610 1610
1611 /* If finger is my friend, then send a trail teardown message and then set 1611 /* If finger is my friend, then send a trail teardown message and then set
1612 * trail_length = 0; */ 1612 * trail_length = 0; */
1613 if (GNUNET_CONTAINER_multipeermap_get (friend_peermap, finger)) 1613 if (GNUNET_CONTAINER_multipeermap_get (friend_peermap, finger))
@@ -1677,7 +1677,7 @@ static void
1677free_finger (struct FingerInfo *finger) 1677free_finger (struct FingerInfo *finger)
1678{ 1678{
1679 struct TrailPeerList *peer; 1679 struct TrailPeerList *peer;
1680 1680
1681 if(finger->first_trail_head != NULL) 1681 if(finger->first_trail_head != NULL)
1682 { 1682 {
1683 while (NULL != (peer = finger->first_trail_head)) 1683 while (NULL != (peer = finger->first_trail_head))
@@ -1715,7 +1715,6 @@ void send_trail_teardown (struct FingerInfo *removed_finger)
1715 int removed_finger_trail_length = removed_finger->first_trail_length; 1715 int removed_finger_trail_length = removed_finger->first_trail_length;
1716 int i = 0; 1716 int i = 0;
1717 1717
1718
1719 if (removed_finger->first_trail_length == 0) 1718 if (removed_finger->first_trail_length == 0)
1720 return; 1719 return;
1721 finger_trail = removed_finger->first_trail_head; 1720 finger_trail = removed_finger->first_trail_head;
@@ -2114,6 +2113,7 @@ compare_and_update_predecessor (const struct GNUNET_PeerIdentity *peer,
2114 memcpy (&(new_finger_entry->finger_identity), peer, sizeof (struct GNUNET_PeerIdentity)); 2113 memcpy (&(new_finger_entry->finger_identity), peer, sizeof (struct GNUNET_PeerIdentity));
2115 new_finger_entry->finger_map_index = PREDECESSOR_FINGER_ID; 2114 new_finger_entry->finger_map_index = PREDECESSOR_FINGER_ID;
2116 new_finger_entry->first_trail_length = trail_length; 2115 new_finger_entry->first_trail_length = trail_length;
2116 new_finger_entry->trail_count = 1;
2117 2117
2118 if (trail != NULL) /* finger_trail is NULL in case I am my own finger identity. */ 2118 if (trail != NULL) /* finger_trail is NULL in case I am my own finger identity. */
2119 { 2119 {
@@ -2357,6 +2357,7 @@ int finger_table_add (const struct GNUNET_PeerIdentity *finger_identity,
2357 current_search_finger_index = current_search_finger_index - 1; 2357 current_search_finger_index = current_search_finger_index - 1;
2358 } 2358 }
2359 2359
2360
2360 return new_entry_added; 2361 return new_entry_added;
2361} 2362}
2362 2363
@@ -2494,9 +2495,7 @@ find_successor (uint64_t value, struct GNUNET_PeerIdentity *current_destination,
2494} 2495}
2495 2496
2496 2497
2497/** FIXME: by default I keep current_source, and destination as my own id. 2498/**
2498 * in case we find a finger then we update current_source in the
2499 * find_successor message.
2500 * Construct a Put message and send it to target_peer. 2499 * Construct a Put message and send it to target_peer.
2501 * @param key Key for the content 2500 * @param key Key for the content
2502 * @param data Content to store 2501 * @param data Content to store
@@ -2553,18 +2552,11 @@ GDS_NEIGHBOURS_send_put (const struct GNUNET_HashCode *key,
2553 { 2552 {
2554 uint64_t key_value; 2553 uint64_t key_value;
2555 struct GNUNET_PeerIdentity *next_hop; 2554 struct GNUNET_PeerIdentity *next_hop;
2555
2556 memcpy (&key_value, key, sizeof (uint64_t)); 2556 memcpy (&key_value, key, sizeof (uint64_t));
2557 struct GNUNET_PeerIdentity curr_dest; 2557 next_hop = find_successor (key_value, &current_destination, &current_source);
2558 struct GNUNET_PeerIdentity curr_src; 2558
2559 memcpy (&curr_dest, &current_destination, sizeof (struct GNUNET_PeerIdentity)); 2559 if (0 == GNUNET_CRYPTO_cmp_peer_identity(next_hop, &current_destination)) /* I am the destination do datacache_put */
2560 memcpy (&curr_src, &current_source, sizeof (struct GNUNET_PeerIdentity));
2561 next_hop = find_successor (key_value, &curr_dest, &curr_src);
2562 /* FIXME: I am copying back current_destination and current_source. but I am not
2563 sure, if its correct. I am doing so just to remove the code from client file.*/
2564 memcpy (&current_destination, &curr_dest, sizeof (struct GNUNET_PeerIdentity));
2565 memcpy (&current_source, &curr_src, sizeof (struct GNUNET_PeerIdentity));
2566
2567 if (0 == GNUNET_CRYPTO_cmp_peer_identity(&my_identity,&current_destination)) /* I am the destination do datacache_put */
2568 { 2560 {
2569 GDS_DATACACHE_handle_put (expiration_time, key, put_path_length, put_path, 2561 GDS_DATACACHE_handle_put (expiration_time, key, put_path_length, put_path,
2570 block_type, data_size, data); 2562 block_type, data_size, data);
@@ -2604,9 +2596,7 @@ GDS_NEIGHBOURS_send_put (const struct GNUNET_HashCode *key,
2604 2596
2605 2597
2606 2598
2607/** FIXME: by default I keep current_source, and destination as my own id. 2599/**
2608 * in case we find a finger then we update current_source in the
2609 * find_successor message.
2610 * Construct a Get message and send it to target_peer. 2600 * Construct a Get message and send it to target_peer.
2611 * @param key Key for the content 2601 * @param key Key for the content
2612 * @param block_type Type of the block 2602 * @param block_type Type of the block
@@ -2652,18 +2642,12 @@ GDS_NEIGHBOURS_send_get (const struct GNUNET_HashCode *key,
2652 /* This is the first call from client file, we need to search for next_hop*/ 2642 /* This is the first call from client file, we need to search for next_hop*/
2653 struct GNUNET_PeerIdentity *next_hop; 2643 struct GNUNET_PeerIdentity *next_hop;
2654 uint64_t key_value; 2644 uint64_t key_value;
2655 struct GNUNET_PeerIdentity curr_dest; 2645
2656 struct GNUNET_PeerIdentity curr_src;
2657 memcpy (&curr_dest, &current_destination, sizeof (struct GNUNET_PeerIdentity));
2658 memcpy (&curr_src, &current_source, sizeof (struct GNUNET_PeerIdentity));
2659 memcpy (&key_value, key, sizeof (uint64_t)); 2646 memcpy (&key_value, key, sizeof (uint64_t));
2660 // FIXME: endianess of key_value!? 2647 // FIXME: endianess of key_value!?
2661 next_hop = find_successor (key_value, &curr_dest, &curr_src); 2648 next_hop = find_successor (key_value, &current_destination, &current_source);
2662 /* FIXME: Again I am copying back value of current_destination, current_source, 2649
2663 Think of a better solution. */ 2650 if (0 == GNUNET_CRYPTO_cmp_peer_identity(&my_identity,next_hop)) /* I am the destination do datacache_put */
2664 memcpy (&current_destination, &curr_dest, sizeof (struct GNUNET_PeerIdentity));
2665 memcpy (&current_source, &curr_src, sizeof (struct GNUNET_PeerIdentity));
2666 if (NULL == next_hop) /* I am the destination do datacache_put */
2667 { 2651 {
2668 GDS_DATACACHE_handle_get (key,block_type, NULL, 0, 2652 GDS_DATACACHE_handle_get (key,block_type, NULL, 0,
2669 NULL, 0, 1, &my_identity, NULL,&my_identity); 2653 NULL, 0, 1, &my_identity, NULL,&my_identity);
@@ -2687,8 +2671,11 @@ GDS_NEIGHBOURS_send_get (const struct GNUNET_HashCode *key,
2687 pgm->current_source = current_source; 2671 pgm->current_source = current_source;
2688 pgm->hop_count = htonl (hop_count + 1); 2672 pgm->hop_count = htonl (hop_count + 1);
2689 2673
2690 gp = (struct GNUNET_PeerIdentity *) &pgm[1]; 2674 if (get_path != 0)
2691 memcpy (gp, get_path, get_path_length * sizeof (struct GNUNET_PeerIdentity)); 2675 {
2676 gp = (struct GNUNET_PeerIdentity *) &pgm[1];
2677 memcpy (gp, get_path, get_path_length * sizeof (struct GNUNET_PeerIdentity));
2678 }
2692 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 2679 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
2693 target_friend->pending_count++; 2680 target_friend->pending_count++;
2694 process_friend_queue (target_friend); 2681 process_friend_queue (target_friend);
@@ -2739,13 +2726,18 @@ GDS_NEIGHBOURS_send_get_result (struct GNUNET_TIME_Absolute expiration,
2739 } 2726 }
2740 2727
2741 current_path_index = search_my_index(get_path, get_path_length); 2728 current_path_index = search_my_index(get_path, get_path_length);
2742 /* FIXME: handle the case when current_path_index = GNUNET_SYSERR;*/ 2729 if (GNUNET_SYSERR == current_path_index)
2730 {
2731 GNUNET_break (0);
2732 return;
2733 }
2743 if (0 == current_path_index) 2734 if (0 == current_path_index)
2744 { 2735 {
2745 GDS_CLIENTS_handle_reply (expiration, key, get_path_length, get_path, put_path_length, 2736 GDS_CLIENTS_handle_reply (expiration, key, get_path_length, get_path, put_path_length,
2746 put_path, type, data_size, data); 2737 put_path, type, data_size, data);
2747 return; 2738 return;
2748 } 2739 }
2740
2749 pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); 2741 pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize);
2750 pending->importance = 0; 2742 pending->importance = 0;
2751 get_result = (struct PeerGetResultMessage *)&pending[1]; 2743 get_result = (struct PeerGetResultMessage *)&pending[1];
@@ -2756,14 +2748,20 @@ GDS_NEIGHBOURS_send_get_result (struct GNUNET_TIME_Absolute expiration,
2756 memcpy (&(get_result->source_peer), source_peer, sizeof (struct GNUNET_PeerIdentity)); 2748 memcpy (&(get_result->source_peer), source_peer, sizeof (struct GNUNET_PeerIdentity));
2757 get_result->expiration_time = expiration; 2749 get_result->expiration_time = expiration;
2758 2750
2759 get_result_path = (struct GNUNET_PeerIdentity *)&get_result[1]; 2751 if (get_path_length != 0)
2760 memcpy (get_result_path, get_path, 2752 {
2761 sizeof (struct GNUNET_PeerIdentity) * get_path_length); 2753 get_result_path = (struct GNUNET_PeerIdentity *)&get_result[1];
2754 memcpy (get_result_path, get_path,
2755 sizeof (struct GNUNET_PeerIdentity) * get_path_length);
2756 }
2762 memcpy (&get_result_path[get_path_length], data, data_size); 2757 memcpy (&get_result_path[get_path_length], data, data_size);
2763 /* FIXME: Is this correct? */
2764 pp = (struct GNUNET_PeerIdentity *)&get_result_path[1];
2765 memcpy (pp, put_path,sizeof (struct GNUNET_PeerIdentity) * put_path_length);
2766 2758
2759 /* FIXME: Is this correct? */
2760 if (put_path_length != 0)
2761 {
2762 pp = (struct GNUNET_PeerIdentity *)&get_result_path[1];
2763 memcpy (pp, put_path,sizeof (struct GNUNET_PeerIdentity) * put_path_length);
2764 }
2767 target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, next_hop); 2765 target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, next_hop);
2768 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 2766 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
2769 target_friend->pending_count++; 2767 target_friend->pending_count++;
@@ -2960,7 +2958,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
2960 next_hop = find_successor (key_value, &current_destination, &current_source); 2958 next_hop = find_successor (key_value, &current_destination, &current_source);
2961 } 2959 }
2962 2960
2963 if (NULL == next_hop) /* I am the final destination */ 2961 if (0 == GNUNET_CRYPTO_cmp_peer_identity(&my_identity, next_hop)) /* I am the final destination */
2964 { 2962 {
2965 GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time), 2963 GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time),
2966 &(put->key),putlen, pp, ntohl (put->block_type), 2964 &(put->key),putlen, pp, ntohl (put->block_type),
@@ -3036,6 +3034,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
3036 GNUNET_break_op (0); 3034 GNUNET_break_op (0);
3037 return GNUNET_YES; 3035 return GNUNET_YES;
3038 } 3036 }
3037
3039 /* Add sender to get path */ 3038 /* Add sender to get path */
3040 struct GNUNET_PeerIdentity gp[get_length + 1]; 3039 struct GNUNET_PeerIdentity gp[get_length + 1];
3041 memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity)); 3040 memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity));
@@ -3053,21 +3052,22 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
3053 } 3052 }
3054 else 3053 else
3055 { 3054 {
3056 next_hop = find_successor (key_value, &current_destination, &current_source); 3055 next_hop = find_successor (key_value, &current_destination, &current_source);
3057 } 3056 }
3058 3057
3059 if (NULL == next_hop) 3058 if (0 == GNUNET_CRYPTO_cmp_peer_identity(&my_identity, next_hop))
3060 { 3059 {
3061 /* FIXME: Try to make this code also short and remove useless variables. */ 3060 /* I am the destination.*/
3062 struct GNUNET_PeerIdentity final_get_path[get_length+1]; 3061 struct GNUNET_PeerIdentity final_get_path[get_length+1];
3062 struct GNUNET_PeerIdentity next_hop;
3063
3063 memcpy (final_get_path, gp, get_length * sizeof (struct GNUNET_PeerIdentity)); 3064 memcpy (final_get_path, gp, get_length * sizeof (struct GNUNET_PeerIdentity));
3064 memcpy (&final_get_path[get_length+1], &my_identity, sizeof (struct GNUNET_PeerIdentity)); 3065 memcpy (&final_get_path[get_length+1], &my_identity, sizeof (struct GNUNET_PeerIdentity));
3065 get_length = get_length + 1; 3066 get_length = get_length + 1;
3066 struct GNUNET_PeerIdentity *next_hop; 3067 memcpy (&next_hop, &final_get_path[get_length-2], sizeof (struct GNUNET_PeerIdentity));
3067 next_hop = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity)); 3068
3068 memcpy (next_hop, &final_get_path[get_length-2], sizeof (struct GNUNET_PeerIdentity));
3069 GDS_DATACACHE_handle_get (&(get->key),(get->block_type), NULL, 0, NULL, 0, 3069 GDS_DATACACHE_handle_get (&(get->key),(get->block_type), NULL, 0, NULL, 0,
3070 get_length, final_get_path,next_hop, &my_identity); 3070 get_length, final_get_path,&next_hop, &my_identity);
3071 3071
3072 return GNUNET_YES; 3072 return GNUNET_YES;
3073 } 3073 }
@@ -3076,13 +3076,12 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
3076 GDS_NEIGHBOURS_send_get (&(get->key), get->block_type, get->options, 3076 GDS_NEIGHBOURS_send_get (&(get->key), get->block_type, get->options,
3077 get->desired_replication_level,current_destination, 3077 get->desired_replication_level,current_destination,
3078 current_source, next_hop, 0, 3078 current_source, next_hop, 0,
3079 get_length, gp); 3079 get_length, gp);
3080 } 3080 }
3081 return GNUNET_SYSERR; 3081 return GNUNET_SYSERR;
3082} 3082}
3083 3083
3084 3084
3085
3086/** 3085/**
3087 * FIXME: In case of trail, we don't have source and destination part of the trail, 3086 * FIXME: In case of trail, we don't have source and destination part of the trail,
3088 * Check if we follow the same in case of get/put/get_result. Also, in case of 3087 * Check if we follow the same in case of get/put/get_result. Also, in case of
@@ -3289,7 +3288,7 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer,
3289 { 3288 {
3290 /* FIXME: Is this correct assumption? A peer which think I am its predecessor, 3289 /* FIXME: Is this correct assumption? A peer which think I am its predecessor,
3291 then I am not its predecessor. */ 3290 then I am not its predecessor. */
3292 compare_and_update_predecessor (&source, trail_peer_list, trail_length ); 3291 compare_and_update_predecessor (&source, trail_peer_list, trail_length );
3293 } 3292 }
3294 GDS_NEIGHBOURS_send_trail_setup_result (&source, 3293 GDS_NEIGHBOURS_send_trail_setup_result (&source,
3295 &(my_identity), 3294 &(my_identity),
@@ -3475,7 +3474,8 @@ handle_dht_p2p_verify_successor(void *cls, const struct GNUNET_PeerIdentity *pee
3475 GNUNET_break_op (0); 3474 GNUNET_break_op (0);
3476 return GNUNET_YES; 3475 return GNUNET_YES;
3477 } 3476 }
3478 trail_peer_list = (const struct GNUNET_PeerIdentity *)&vsm[1]; 3477 if (trail_length > 0)
3478 trail_peer_list = (const struct GNUNET_PeerIdentity *)&vsm[1];
3479 memcpy (&source_peer, &(vsm->source_peer), sizeof(struct GNUNET_PeerIdentity)); 3479 memcpy (&source_peer, &(vsm->source_peer), sizeof(struct GNUNET_PeerIdentity));
3480 3480
3481 if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&(vsm->successor),&my_identity))) 3481 if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&(vsm->successor),&my_identity)))
@@ -3518,7 +3518,7 @@ handle_dht_p2p_verify_successor(void *cls, const struct GNUNET_PeerIdentity *pee
3518 struct TrailPeerList *iterator; 3518 struct TrailPeerList *iterator;
3519 int new_trail_length; 3519 int new_trail_length;
3520 int i; 3520 int i;
3521 3521
3522 new_trail_length = trail_length + my_predecessor->first_trail_length + 1; 3522 new_trail_length = trail_length + my_predecessor->first_trail_length + 1;
3523 new_successor_trail = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity) * new_trail_length); 3523 new_successor_trail = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity) * new_trail_length);
3524 if (trail_length > 0) 3524 if (trail_length > 0)
@@ -3538,7 +3538,6 @@ handle_dht_p2p_verify_successor(void *cls, const struct GNUNET_PeerIdentity *pee
3538 i++; 3538 i++;
3539 } 3539 }
3540 } 3540 }
3541
3542 GDS_NEIGHBOURS_send_verify_successor_result (&source_peer, 3541 GDS_NEIGHBOURS_send_verify_successor_result (&source_peer,
3543 &(my_identity), 3542 &(my_identity),
3544 &(my_predecessor->finger_identity), 3543 &(my_predecessor->finger_identity),