diff options
Diffstat (limited to 'src/dht/gnunet-service-xdht_neighbours.c')
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index 8684ada0e..00bc69424 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -854,25 +854,25 @@ struct VerifySuccessorContext | |||
854 | * Task that sends FIND FINGER TRAIL requests. This task is started when we have | 854 | * Task that sends FIND FINGER TRAIL requests. This task is started when we have |
855 | * get our first friend. | 855 | * get our first friend. |
856 | */ | 856 | */ |
857 | static GNUNET_SCHEDULER_TaskIdentifier find_finger_trail_task; | 857 | static struct GNUNET_SCHEDULER_Task * find_finger_trail_task; |
858 | 858 | ||
859 | /** | 859 | /** |
860 | * Task that sends verify successor message. This task is started when we get | 860 | * Task that sends verify successor message. This task is started when we get |
861 | * our successor for the first time. | 861 | * our successor for the first time. |
862 | */ | 862 | */ |
863 | static GNUNET_SCHEDULER_TaskIdentifier send_verify_successor_task; | 863 | static struct GNUNET_SCHEDULER_Task * send_verify_successor_task; |
864 | 864 | ||
865 | /** | 865 | /** |
866 | * Task that sends verify successor message. This task is started when we get | 866 | * Task that sends verify successor message. This task is started when we get |
867 | * our successor for the first time. | 867 | * our successor for the first time. |
868 | */ | 868 | */ |
869 | static GNUNET_SCHEDULER_TaskIdentifier send_verify_successor_retry_task; | 869 | static struct GNUNET_SCHEDULER_Task * send_verify_successor_retry_task; |
870 | 870 | ||
871 | /** | 871 | /** |
872 | * Task that sends verify successor message. This task is started when we get | 872 | * Task that sends verify successor message. This task is started when we get |
873 | * our successor for the first time. | 873 | * our successor for the first time. |
874 | */ | 874 | */ |
875 | static GNUNET_SCHEDULER_TaskIdentifier send_notify_new_successor_retry_task; | 875 | static struct GNUNET_SCHEDULER_Task * send_notify_new_successor_retry_task; |
876 | 876 | ||
877 | /** | 877 | /** |
878 | * Identity of this peer. | 878 | * Identity of this peer. |
@@ -3238,7 +3238,7 @@ send_verify_successor_message (void *cls, | |||
3238 | successor = &finger_table[0]; | 3238 | successor = &finger_table[0]; |
3239 | 3239 | ||
3240 | /* This task will be scheduled when the result for Verify Successor is received. */ | 3240 | /* This task will be scheduled when the result for Verify Successor is received. */ |
3241 | send_verify_successor_task = GNUNET_SCHEDULER_NO_TASK; | 3241 | send_verify_successor_task = NULL; |
3242 | 3242 | ||
3243 | /* When verify successor is being called for first time *for current context* | 3243 | /* When verify successor is being called for first time *for current context* |
3244 | * cls will be NULL. If send_verify_successor_retry_task is not NO_TASK, we | 3244 | * cls will be NULL. If send_verify_successor_retry_task is not NO_TASK, we |
@@ -3259,7 +3259,7 @@ send_verify_successor_message (void *cls, | |||
3259 | * --> Waiting for notify confirmation. again don't wait for it. notify | 3259 | * --> Waiting for notify confirmation. again don't wait for it. notify |
3260 | * confirmation will not succeded. | 3260 | * confirmation will not succeded. |
3261 | */ | 3261 | */ |
3262 | if (send_verify_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) | 3262 | if (send_verify_successor_retry_task != NULL) |
3263 | { | 3263 | { |
3264 | /* FIXME: Are we scheduling retry task as soon as we send verify message. | 3264 | /* FIXME: Are we scheduling retry task as soon as we send verify message. |
3265 | If yes then here before making this task, first check if the message | 3265 | If yes then here before making this task, first check if the message |
@@ -3374,7 +3374,7 @@ update_current_search_finger_index (unsigned int finger_table_index) | |||
3374 | current_search_finger_index = PREDECESSOR_FINGER_ID; | 3374 | current_search_finger_index = PREDECESSOR_FINGER_ID; |
3375 | if (0 != GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &successor->finger_identity)) | 3375 | if (0 != GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &successor->finger_identity)) |
3376 | { | 3376 | { |
3377 | if (GNUNET_SCHEDULER_NO_TASK == send_verify_successor_task) | 3377 | if (NULL == send_verify_successor_task) |
3378 | { | 3378 | { |
3379 | send_verify_successor_task = | 3379 | send_verify_successor_task = |
3380 | GNUNET_SCHEDULER_add_now (&send_verify_successor_message, NULL); | 3380 | GNUNET_SCHEDULER_add_now (&send_verify_successor_message, NULL); |
@@ -5133,7 +5133,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ, | |||
5133 | GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); | 5133 | GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); |
5134 | GNUNET_free (key); | 5134 | GNUNET_free (key); |
5135 | } | 5135 | } |
5136 | if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) | 5136 | if (send_verify_successor_task == NULL) |
5137 | send_verify_successor_task = | 5137 | send_verify_successor_task = |
5138 | GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, | 5138 | GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, |
5139 | &send_verify_successor_message, | 5139 | &send_verify_successor_message, |
@@ -5173,7 +5173,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ, | |||
5173 | successor_times--; | 5173 | successor_times--; |
5174 | 5174 | ||
5175 | 5175 | ||
5176 | if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) | 5176 | if (send_verify_successor_task == NULL) |
5177 | send_verify_successor_task = | 5177 | send_verify_successor_task = |
5178 | GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, | 5178 | GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, |
5179 | &send_verify_successor_message, | 5179 | &send_verify_successor_message, |
@@ -5262,7 +5262,7 @@ send_notify_new_successor (void *cls, | |||
5262 | ctx->target_friend); | 5262 | ctx->target_friend); |
5263 | 5263 | ||
5264 | if (0 == ctx->num_retries_scheduled && | 5264 | if (0 == ctx->num_retries_scheduled && |
5265 | send_notify_new_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) | 5265 | send_notify_new_successor_retry_task != NULL) |
5266 | { | 5266 | { |
5267 | // Result from previous notify successos hasn't arrived, so the retry task | 5267 | // Result from previous notify successos hasn't arrived, so the retry task |
5268 | // hasn't been cancelled! Already a new notify successor must be called. | 5268 | // hasn't been cancelled! Already a new notify successor must be called. |
@@ -5271,7 +5271,7 @@ send_notify_new_successor (void *cls, | |||
5271 | old_notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); | 5271 | old_notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); |
5272 | GNUNET_free (old_notify_ctx->successor_trail); | 5272 | GNUNET_free (old_notify_ctx->successor_trail); |
5273 | GNUNET_free (old_notify_ctx); | 5273 | GNUNET_free (old_notify_ctx); |
5274 | send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; | 5274 | send_notify_new_successor_retry_task = NULL; |
5275 | } | 5275 | } |
5276 | 5276 | ||
5277 | ctx->num_retries_scheduled++; | 5277 | ctx->num_retries_scheduled++; |
@@ -5337,12 +5337,12 @@ handle_dht_p2p_verify_successor_result(void *cls, | |||
5337 | if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&querying_peer, &my_identity))) | 5337 | if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&querying_peer, &my_identity))) |
5338 | { | 5338 | { |
5339 | /* Cancel Retry Task */ | 5339 | /* Cancel Retry Task */ |
5340 | if (GNUNET_SCHEDULER_NO_TASK != send_verify_successor_retry_task) | 5340 | if (NULL != send_verify_successor_retry_task) |
5341 | { | 5341 | { |
5342 | struct VerifySuccessorContext *ctx; | 5342 | struct VerifySuccessorContext *ctx; |
5343 | ctx = GNUNET_SCHEDULER_cancel(send_verify_successor_retry_task); | 5343 | ctx = GNUNET_SCHEDULER_cancel(send_verify_successor_retry_task); |
5344 | GNUNET_free(ctx); | 5344 | GNUNET_free(ctx); |
5345 | send_verify_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; | 5345 | send_verify_successor_retry_task = NULL; |
5346 | } | 5346 | } |
5347 | compare_and_update_successor (current_successor, | 5347 | compare_and_update_successor (current_successor, |
5348 | probable_successor, trail, trail_length); | 5348 | probable_successor, trail, trail_length); |
@@ -5533,15 +5533,15 @@ handle_dht_p2p_notify_succ_confirmation (void *cls, | |||
5533 | */ | 5533 | */ |
5534 | 5534 | ||
5535 | // TODO: cancel schedule of notify_successor_retry_task | 5535 | // TODO: cancel schedule of notify_successor_retry_task |
5536 | if (send_notify_new_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) | 5536 | if (send_notify_new_successor_retry_task != NULL) |
5537 | { | 5537 | { |
5538 | struct SendNotifyContext *notify_ctx; | 5538 | struct SendNotifyContext *notify_ctx; |
5539 | notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); | 5539 | notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); |
5540 | GNUNET_free (notify_ctx->successor_trail); | 5540 | GNUNET_free (notify_ctx->successor_trail); |
5541 | GNUNET_free (notify_ctx); | 5541 | GNUNET_free (notify_ctx); |
5542 | send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; | 5542 | send_notify_new_successor_retry_task = NULL; |
5543 | } | 5543 | } |
5544 | if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) | 5544 | if (send_verify_successor_task == NULL) |
5545 | { | 5545 | { |
5546 | verify_successor_next_send_time.rel_value_us = | 5546 | verify_successor_next_send_time.rel_value_us = |
5547 | DHT_SEND_VERIFY_SUCCESSOR_INTERVAL.rel_value_us + | 5547 | DHT_SEND_VERIFY_SUCCESSOR_INTERVAL.rel_value_us + |
@@ -6063,10 +6063,10 @@ handle_core_disconnect (void *cls, | |||
6063 | if (0 != GNUNET_CONTAINER_multipeermap_size (friend_peermap)) | 6063 | if (0 != GNUNET_CONTAINER_multipeermap_size (friend_peermap)) |
6064 | return; | 6064 | return; |
6065 | 6065 | ||
6066 | if (GNUNET_SCHEDULER_NO_TASK != find_finger_trail_task) | 6066 | if (NULL != find_finger_trail_task) |
6067 | { | 6067 | { |
6068 | GNUNET_SCHEDULER_cancel (find_finger_trail_task); | 6068 | GNUNET_SCHEDULER_cancel (find_finger_trail_task); |
6069 | find_finger_trail_task = GNUNET_SCHEDULER_NO_TASK; | 6069 | find_finger_trail_task = NULL; |
6070 | } | 6070 | } |
6071 | else | 6071 | else |
6072 | GNUNET_break (0); | 6072 | GNUNET_break (0); |
@@ -6109,7 +6109,7 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer_identity) | |||
6109 | * selected after some time out. This is to ensure that both peers have added | 6109 | * selected after some time out. This is to ensure that both peers have added |
6110 | * each other as their friend. */ | 6110 | * each other as their friend. */ |
6111 | /* Got a first connection, good time to start with FIND FINGER TRAIL requests...*/ | 6111 | /* Got a first connection, good time to start with FIND FINGER TRAIL requests...*/ |
6112 | if (GNUNET_SCHEDULER_NO_TASK == find_finger_trail_task) | 6112 | if (NULL == find_finger_trail_task) |
6113 | { | 6113 | { |
6114 | find_finger_trail_task = GNUNET_SCHEDULER_add_now (&send_find_finger_trail_message, NULL); | 6114 | find_finger_trail_task = GNUNET_SCHEDULER_add_now (&send_find_finger_trail_message, NULL); |
6115 | } | 6115 | } |
@@ -6244,33 +6244,33 @@ GDS_NEIGHBOURS_done (void) | |||
6244 | GNUNET_CONTAINER_multipeermap_destroy (friend_peermap); | 6244 | GNUNET_CONTAINER_multipeermap_destroy (friend_peermap); |
6245 | friend_peermap = NULL; | 6245 | friend_peermap = NULL; |
6246 | 6246 | ||
6247 | if (GNUNET_SCHEDULER_NO_TASK != find_finger_trail_task) | 6247 | if (NULL != find_finger_trail_task) |
6248 | { | 6248 | { |
6249 | GNUNET_SCHEDULER_cancel (find_finger_trail_task); | 6249 | GNUNET_SCHEDULER_cancel (find_finger_trail_task); |
6250 | find_finger_trail_task = GNUNET_SCHEDULER_NO_TASK; | 6250 | find_finger_trail_task = NULL; |
6251 | } | 6251 | } |
6252 | 6252 | ||
6253 | if (GNUNET_SCHEDULER_NO_TASK != send_verify_successor_task) | 6253 | if (NULL != send_verify_successor_task) |
6254 | { | 6254 | { |
6255 | GNUNET_SCHEDULER_cancel (send_verify_successor_task); | 6255 | GNUNET_SCHEDULER_cancel (send_verify_successor_task); |
6256 | send_verify_successor_task = GNUNET_SCHEDULER_NO_TASK; | 6256 | send_verify_successor_task = NULL; |
6257 | } | 6257 | } |
6258 | 6258 | ||
6259 | if (GNUNET_SCHEDULER_NO_TASK != send_verify_successor_retry_task) | 6259 | if (NULL != send_verify_successor_retry_task) |
6260 | { | 6260 | { |
6261 | struct VerifySuccessorContext *ctx; | 6261 | struct VerifySuccessorContext *ctx; |
6262 | ctx = GNUNET_SCHEDULER_cancel (send_verify_successor_retry_task); | 6262 | ctx = GNUNET_SCHEDULER_cancel (send_verify_successor_retry_task); |
6263 | GNUNET_free(ctx); | 6263 | GNUNET_free(ctx); |
6264 | send_verify_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; | 6264 | send_verify_successor_retry_task = NULL; |
6265 | } | 6265 | } |
6266 | 6266 | ||
6267 | if (send_notify_new_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) | 6267 | if (send_notify_new_successor_retry_task != NULL) |
6268 | { | 6268 | { |
6269 | struct SendNotifyContext *notify_ctx; | 6269 | struct SendNotifyContext *notify_ctx; |
6270 | notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); | 6270 | notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); |
6271 | GNUNET_free (notify_ctx->successor_trail); | 6271 | GNUNET_free (notify_ctx->successor_trail); |
6272 | GNUNET_free (notify_ctx); | 6272 | GNUNET_free (notify_ctx); |
6273 | send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; | 6273 | send_notify_new_successor_retry_task = NULL; |
6274 | } | 6274 | } |
6275 | } | 6275 | } |
6276 | 6276 | ||