diff options
author | Supriti Singh <supritisingh08@gmail.com> | 2014-08-16 13:40:38 +0000 |
---|---|---|
committer | Supriti Singh <supritisingh08@gmail.com> | 2014-08-16 13:40:38 +0000 |
commit | c4f67446e0b6ec727f3aa4dffc8e7a4f1eaac4c3 (patch) | |
tree | 690c7042507dec528a9beb37bcc1ea5fabade13b /src | |
parent | 9d6fcf6964aa39a0b4d737b78bd9f5931cce25d4 (diff) | |
download | gnunet-c4f67446e0b6ec727f3aa4dffc8e7a4f1eaac4c3.tar.gz gnunet-c4f67446e0b6ec727f3aa4dffc8e7a4f1eaac4c3.zip |
xvine:fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index d086345fb..c5136a504 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -3296,6 +3296,7 @@ send_verify_successor_message (void *cls, | |||
3296 | 3296 | ||
3297 | 3297 | ||
3298 | /** | 3298 | /** |
3299 | * FIXME: should this be a periodic task, incrementing the search finger index? | ||
3299 | * Update the current search finger index. | 3300 | * Update the current search finger index. |
3300 | * | 3301 | * |
3301 | * FIXME document parameters! | 3302 | * FIXME document parameters! |
@@ -3734,6 +3735,19 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
3734 | } | 3735 | } |
3735 | } | 3736 | } |
3736 | 3737 | ||
3738 | #if 0 | ||
3739 | /* Check if you are present in the trail already. */ | ||
3740 | unsigned int i; | ||
3741 | for (i = 0; i < putlen; i++) | ||
3742 | { | ||
3743 | if(0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &put_path[i])) | ||
3744 | { | ||
3745 | putlen = i; | ||
3746 | break; | ||
3747 | } | ||
3748 | } | ||
3749 | #endif | ||
3750 | //FIXME: always add yourself to the peer list not the sender. | ||
3737 | /* extend 'put path' by sender */ | 3751 | /* extend 'put path' by sender */ |
3738 | struct GNUNET_PeerIdentity pp[putlen + 1]; | 3752 | struct GNUNET_PeerIdentity pp[putlen + 1]; |
3739 | if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) | 3753 | if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) |
@@ -5768,7 +5782,7 @@ remove_matching_fingers (const struct GNUNET_PeerIdentity *disconnected_peer) | |||
5768 | for (i = 0; i < MAX_FINGERS; i++) | 5782 | for (i = 0; i < MAX_FINGERS; i++) |
5769 | { | 5783 | { |
5770 | remove_finger = &finger_table[i]; | 5784 | remove_finger = &finger_table[i]; |
5771 | 5785 | ||
5772 | /* No finger stored at this trail index. */ | 5786 | /* No finger stored at this trail index. */ |
5773 | if (GNUNET_NO == remove_finger->is_present) | 5787 | if (GNUNET_NO == remove_finger->is_present) |
5774 | continue; | 5788 | continue; |
@@ -5784,11 +5798,12 @@ remove_matching_fingers (const struct GNUNET_PeerIdentity *disconnected_peer) | |||
5784 | { | 5798 | { |
5785 | struct GNUNET_PeerIdentity *next_hop; | 5799 | struct GNUNET_PeerIdentity *next_hop; |
5786 | struct GNUNET_HashCode trail_id; | 5800 | struct GNUNET_HashCode trail_id; |
5787 | 5801 | /* FIXME: Just for check, remove it afterwards. Here finger is a friend. | |
5788 | 5802 | hence trail length should be 0.*/ | |
5803 | GNUNET_assert (0 == remove_finger->trail_list[0].trail_length); | ||
5789 | GNUNET_assert (GNUNET_YES == (remove_finger->trail_list[0].is_present)); | 5804 | GNUNET_assert (GNUNET_YES == (remove_finger->trail_list[0].is_present)); |
5790 | trail_id = remove_finger->trail_list[0].trail_id; | 5805 | trail_id = remove_finger->trail_list[0].trail_id; |
5791 | 5806 | ||
5792 | if(NULL != | 5807 | if(NULL != |
5793 | (next_hop = | 5808 | (next_hop = |
5794 | GDS_ROUTING_get_next_hop (trail_id, GDS_ROUTING_SRC_TO_DEST))) | 5809 | GDS_ROUTING_get_next_hop (trail_id, GDS_ROUTING_SRC_TO_DEST))) |
@@ -5833,8 +5848,6 @@ remove_matching_fingers (const struct GNUNET_PeerIdentity *disconnected_peer) | |||
5833 | } | 5848 | } |
5834 | 5849 | ||
5835 | 5850 | ||
5836 | //FIXME: Free the messages of peer from pending qeue. Refere to | ||
5837 | //neighbours file. | ||
5838 | /** | 5851 | /** |
5839 | * Method called whenever a peer disconnects. | 5852 | * Method called whenever a peer disconnects. |
5840 | * | 5853 | * |
@@ -5853,8 +5866,11 @@ handle_core_disconnect (void *cls, | |||
5853 | if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) | 5866 | if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) |
5854 | return; | 5867 | return; |
5855 | 5868 | ||
5856 | GNUNET_assert (NULL != (remove_friend = | 5869 | if(NULL == (remove_friend = |
5857 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, peer))); | 5870 | GNUNET_CONTAINER_multipeermap_get (friend_peermap, peer))) |
5871 | { | ||
5872 | DEBUG("\n friend already disconnected."); | ||
5873 | } | ||
5858 | 5874 | ||
5859 | /* Remove fingers with peer as first friend or if peer is a finger. */ | 5875 | /* Remove fingers with peer as first friend or if peer is a finger. */ |
5860 | remove_matching_fingers (peer); | 5876 | remove_matching_fingers (peer); |
@@ -5864,25 +5880,12 @@ handle_core_disconnect (void *cls, | |||
5864 | * disconnected peer is not part of. */ | 5880 | * disconnected peer is not part of. */ |
5865 | GNUNET_assert (GNUNET_SYSERR != GDS_ROUTING_remove_trail_by_peer (peer)); | 5881 | GNUNET_assert (GNUNET_SYSERR != GDS_ROUTING_remove_trail_by_peer (peer)); |
5866 | 5882 | ||
5867 | //GNUNET_assert (0 == remove_friend->trails_count); //FIXME; why should this fai. | ||
5868 | |||
5869 | /* Remove peer from friend_peermap. */ | 5883 | /* Remove peer from friend_peermap. */ |
5870 | GNUNET_assert (GNUNET_YES == | 5884 | GNUNET_assert (GNUNET_YES == |
5871 | GNUNET_CONTAINER_multipeermap_remove (friend_peermap, | 5885 | GNUNET_CONTAINER_multipeermap_remove (friend_peermap, |
5872 | peer, | 5886 | peer, |
5873 | remove_friend)); | 5887 | remove_friend)); |
5874 | 5888 | ||
5875 | if (0 != GNUNET_CONTAINER_multipeermap_size (friend_peermap)) | ||
5876 | return; | ||
5877 | |||
5878 | if (GNUNET_SCHEDULER_NO_TASK != find_finger_trail_task) | ||
5879 | { | ||
5880 | GNUNET_SCHEDULER_cancel (find_finger_trail_task); | ||
5881 | find_finger_trail_task = GNUNET_SCHEDULER_NO_TASK; | ||
5882 | } | ||
5883 | else | ||
5884 | GNUNET_break (0); | ||
5885 | |||
5886 | /* Remove all the messages queued in pending list of this peer is discarded.*/ | 5889 | /* Remove all the messages queued in pending list of this peer is discarded.*/ |
5887 | if (remove_friend->th != NULL) | 5890 | if (remove_friend->th != NULL) |
5888 | { | 5891 | { |
@@ -5903,6 +5906,17 @@ handle_core_disconnect (void *cls, | |||
5903 | ("# Queued messages discarded (peer disconnected)"), | 5906 | ("# Queued messages discarded (peer disconnected)"), |
5904 | discarded, GNUNET_NO); | 5907 | discarded, GNUNET_NO); |
5905 | GNUNET_free (remove_friend); | 5908 | GNUNET_free (remove_friend); |
5909 | |||
5910 | if (0 != GNUNET_CONTAINER_multipeermap_size (friend_peermap)) | ||
5911 | return; | ||
5912 | |||
5913 | if (GNUNET_SCHEDULER_NO_TASK != find_finger_trail_task) | ||
5914 | { | ||
5915 | GNUNET_SCHEDULER_cancel (find_finger_trail_task); | ||
5916 | find_finger_trail_task = GNUNET_SCHEDULER_NO_TASK; | ||
5917 | } | ||
5918 | else | ||
5919 | GNUNET_break (0); | ||
5906 | } | 5920 | } |
5907 | 5921 | ||
5908 | 5922 | ||