diff options
Diffstat (limited to 'src/topology/gnunet-daemon-topology.c')
-rw-r--r-- | src/topology/gnunet-daemon-topology.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 640b0fbc0..87b899892 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -135,17 +135,17 @@ struct Peer | |||
135 | * ID of task we use to wait for the time to send the next HELLO | 135 | * ID of task we use to wait for the time to send the next HELLO |
136 | * to this peer. | 136 | * to this peer. |
137 | */ | 137 | */ |
138 | GNUNET_SCHEDULER_TaskIdentifier hello_delay_task; | 138 | struct GNUNET_SCHEDULER_Task * hello_delay_task; |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * Task for issuing GNUNET_TRANSPORT_try_connect for this peer. | 141 | * Task for issuing GNUNET_TRANSPORT_try_connect for this peer. |
142 | */ | 142 | */ |
143 | GNUNET_SCHEDULER_TaskIdentifier attempt_connect_task; | 143 | struct GNUNET_SCHEDULER_Task * attempt_connect_task; |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * ID of task we use to clear peers from the greylist. | 146 | * ID of task we use to clear peers from the greylist. |
147 | */ | 147 | */ |
148 | GNUNET_SCHEDULER_TaskIdentifier greylist_clean_task; | 148 | struct GNUNET_SCHEDULER_Task * greylist_clean_task; |
149 | 149 | ||
150 | /** | 150 | /** |
151 | * How often have we tried so far? | 151 | * How often have we tried so far? |
@@ -216,7 +216,7 @@ static struct GNUNET_TIME_Absolute next_connect_attempt; | |||
216 | /** | 216 | /** |
217 | * Task scheduled to try to add peers. | 217 | * Task scheduled to try to add peers. |
218 | */ | 218 | */ |
219 | static GNUNET_SCHEDULER_TaskIdentifier add_task; | 219 | static struct GNUNET_SCHEDULER_Task * add_task; |
220 | 220 | ||
221 | /** | 221 | /** |
222 | * Flag to disallow non-friend connections (pure F2F mode). | 222 | * Flag to disallow non-friend connections (pure F2F mode). |
@@ -331,11 +331,11 @@ free_peer (void *cls, const struct GNUNET_PeerIdentity * pid, void *value) | |||
331 | GNUNET_CONTAINER_multipeermap_remove (peers, pid, pos)); | 331 | GNUNET_CONTAINER_multipeermap_remove (peers, pid, pos)); |
332 | if (pos->hello_req != NULL) | 332 | if (pos->hello_req != NULL) |
333 | GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req); | 333 | GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req); |
334 | if (pos->hello_delay_task != GNUNET_SCHEDULER_NO_TASK) | 334 | if (pos->hello_delay_task != NULL) |
335 | GNUNET_SCHEDULER_cancel (pos->hello_delay_task); | 335 | GNUNET_SCHEDULER_cancel (pos->hello_delay_task); |
336 | if (pos->attempt_connect_task != GNUNET_SCHEDULER_NO_TASK) | 336 | if (pos->attempt_connect_task != NULL) |
337 | GNUNET_SCHEDULER_cancel (pos->attempt_connect_task); | 337 | GNUNET_SCHEDULER_cancel (pos->attempt_connect_task); |
338 | if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK) | 338 | if (pos->greylist_clean_task != NULL) |
339 | GNUNET_SCHEDULER_cancel (pos->greylist_clean_task); | 339 | GNUNET_SCHEDULER_cancel (pos->greylist_clean_task); |
340 | GNUNET_free_non_null (pos->hello); | 340 | GNUNET_free_non_null (pos->hello); |
341 | if (pos->filter != NULL) | 341 | if (pos->filter != NULL) |
@@ -395,7 +395,7 @@ attempt_connect (struct Peer *pos) | |||
395 | pos->next_connect_attempt = GNUNET_TIME_absolute_min (pos->next_connect_attempt, | 395 | pos->next_connect_attempt = GNUNET_TIME_absolute_min (pos->next_connect_attempt, |
396 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), MIN_CONNECT_FREQUENCY_DELAY)); | 396 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), MIN_CONNECT_FREQUENCY_DELAY)); |
397 | 397 | ||
398 | if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK) | 398 | if (pos->greylist_clean_task != NULL) |
399 | GNUNET_SCHEDULER_cancel (pos->greylist_clean_task); | 399 | GNUNET_SCHEDULER_cancel (pos->greylist_clean_task); |
400 | pos->greylist_clean_task = | 400 | pos->greylist_clean_task = |
401 | GNUNET_SCHEDULER_add_delayed (rem, &remove_from_greylist, pos); | 401 | GNUNET_SCHEDULER_add_delayed (rem, &remove_from_greylist, pos); |
@@ -422,7 +422,7 @@ do_attempt_connect (void *cls, | |||
422 | struct Peer *pos = cls; | 422 | struct Peer *pos = cls; |
423 | struct GNUNET_TIME_Relative delay; | 423 | struct GNUNET_TIME_Relative delay; |
424 | 424 | ||
425 | pos->attempt_connect_task = GNUNET_SCHEDULER_NO_TASK; | 425 | pos->attempt_connect_task = NULL; |
426 | if (GNUNET_YES == pos->is_connected) | 426 | if (GNUNET_YES == pos->is_connected) |
427 | return; | 427 | return; |
428 | 428 | ||
@@ -454,7 +454,7 @@ do_attempt_connect (void *cls, | |||
454 | static void | 454 | static void |
455 | schedule_attempt_connect (struct Peer *pos) | 455 | schedule_attempt_connect (struct Peer *pos) |
456 | { | 456 | { |
457 | if (GNUNET_SCHEDULER_NO_TASK != pos->attempt_connect_task) | 457 | if (NULL != pos->attempt_connect_task) |
458 | return; | 458 | return; |
459 | pos->attempt_connect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (next_connect_attempt), | 459 | pos->attempt_connect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (next_connect_attempt), |
460 | &do_attempt_connect, | 460 | &do_attempt_connect, |
@@ -475,7 +475,7 @@ remove_from_greylist (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
475 | struct Peer *pos = cls; | 475 | struct Peer *pos = cls; |
476 | struct GNUNET_TIME_Relative rem; | 476 | struct GNUNET_TIME_Relative rem; |
477 | 477 | ||
478 | pos->greylist_clean_task = GNUNET_SCHEDULER_NO_TASK; | 478 | pos->greylist_clean_task = NULL; |
479 | rem = GNUNET_TIME_absolute_get_remaining (pos->greylisted_until); | 479 | rem = GNUNET_TIME_absolute_get_remaining (pos->greylisted_until); |
480 | if (0 == rem.rel_value_us) | 480 | if (0 == rem.rel_value_us) |
481 | { | 481 | { |
@@ -646,7 +646,7 @@ schedule_next_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
646 | size_t next_want; | 646 | size_t next_want; |
647 | struct GNUNET_TIME_Relative delay; | 647 | struct GNUNET_TIME_Relative delay; |
648 | 648 | ||
649 | pl->hello_delay_task = GNUNET_SCHEDULER_NO_TASK; | 649 | pl->hello_delay_task = NULL; |
650 | GNUNET_assert (GNUNET_YES == pl->is_connected); | 650 | GNUNET_assert (GNUNET_YES == pl->is_connected); |
651 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 651 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
652 | return; /* we're out of here */ | 652 | return; /* we're out of here */ |
@@ -702,10 +702,10 @@ reschedule_hellos (void *cls, const struct GNUNET_PeerIdentity * pid, void *valu | |||
702 | GNUNET_CORE_notify_transmit_ready_cancel (peer->hello_req); | 702 | GNUNET_CORE_notify_transmit_ready_cancel (peer->hello_req); |
703 | peer->hello_req = NULL; | 703 | peer->hello_req = NULL; |
704 | } | 704 | } |
705 | if (peer->hello_delay_task != GNUNET_SCHEDULER_NO_TASK) | 705 | if (peer->hello_delay_task != NULL) |
706 | { | 706 | { |
707 | GNUNET_SCHEDULER_cancel (peer->hello_delay_task); | 707 | GNUNET_SCHEDULER_cancel (peer->hello_delay_task); |
708 | peer->hello_delay_task = GNUNET_SCHEDULER_NO_TASK; | 708 | peer->hello_delay_task = NULL; |
709 | } | 709 | } |
710 | peer->hello_delay_task = | 710 | peer->hello_delay_task = |
711 | GNUNET_SCHEDULER_add_now (&schedule_next_hello, peer); | 711 | GNUNET_SCHEDULER_add_now (&schedule_next_hello, peer); |
@@ -787,7 +787,7 @@ try_add_peers (void *cls, const struct GNUNET_PeerIdentity * pid, void *value) | |||
787 | static void | 787 | static void |
788 | add_peer_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 788 | add_peer_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
789 | { | 789 | { |
790 | add_task = GNUNET_SCHEDULER_NO_TASK; | 790 | add_task = NULL; |
791 | 791 | ||
792 | GNUNET_CONTAINER_multipeermap_iterate (peers, &try_add_peers, NULL); | 792 | GNUNET_CONTAINER_multipeermap_iterate (peers, &try_add_peers, NULL); |
793 | } | 793 | } |
@@ -827,10 +827,10 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
827 | GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req); | 827 | GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req); |
828 | pos->hello_req = NULL; | 828 | pos->hello_req = NULL; |
829 | } | 829 | } |
830 | if (GNUNET_SCHEDULER_NO_TASK != pos->hello_delay_task) | 830 | if (NULL != pos->hello_delay_task) |
831 | { | 831 | { |
832 | GNUNET_SCHEDULER_cancel (pos->hello_delay_task); | 832 | GNUNET_SCHEDULER_cancel (pos->hello_delay_task); |
833 | pos->hello_delay_task = GNUNET_SCHEDULER_NO_TASK; | 833 | pos->hello_delay_task = NULL; |
834 | } | 834 | } |
835 | GNUNET_STATISTICS_set (stats, gettext_noop ("# peers connected"), | 835 | GNUNET_STATISTICS_set (stats, gettext_noop ("# peers connected"), |
836 | connection_count, GNUNET_NO); | 836 | connection_count, GNUNET_NO); |
@@ -842,7 +842,7 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
842 | } | 842 | } |
843 | if (((connection_count < target_connection_count) || | 843 | if (((connection_count < target_connection_count) || |
844 | (friend_count < minimum_friend_count)) && | 844 | (friend_count < minimum_friend_count)) && |
845 | (GNUNET_SCHEDULER_NO_TASK == add_task)) | 845 | (NULL == add_task)) |
846 | add_task = GNUNET_SCHEDULER_add_now (&add_peer_task, NULL); | 846 | add_task = GNUNET_SCHEDULER_add_now (&add_peer_task, NULL); |
847 | if ((friend_count < minimum_friend_count) && (blacklist == NULL)) | 847 | if ((friend_count < minimum_friend_count) && (blacklist == NULL)) |
848 | blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL); | 848 | blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL); |
@@ -1179,7 +1179,7 @@ hello_advertising_ready (void *cls, size_t size, void *buf) | |||
1179 | GNUNET_NO); | 1179 | GNUNET_NO); |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | if (pl->hello_delay_task != GNUNET_SCHEDULER_NO_TASK) | 1182 | if (pl->hello_delay_task != NULL) |
1183 | GNUNET_SCHEDULER_cancel (pl->hello_delay_task); | 1183 | GNUNET_SCHEDULER_cancel (pl->hello_delay_task); |
1184 | pl->next_hello_allowed = | 1184 | pl->next_hello_allowed = |
1185 | GNUNET_TIME_relative_to_absolute (HELLO_ADVERTISEMENT_MIN_FREQUENCY); | 1185 | GNUNET_TIME_relative_to_absolute (HELLO_ADVERTISEMENT_MIN_FREQUENCY); |
@@ -1211,10 +1211,10 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1211 | handle = NULL; | 1211 | handle = NULL; |
1212 | } | 1212 | } |
1213 | whitelist_peers (); | 1213 | whitelist_peers (); |
1214 | if (GNUNET_SCHEDULER_NO_TASK != add_task) | 1214 | if (NULL != add_task) |
1215 | { | 1215 | { |
1216 | GNUNET_SCHEDULER_cancel (add_task); | 1216 | GNUNET_SCHEDULER_cancel (add_task); |
1217 | add_task = GNUNET_SCHEDULER_NO_TASK; | 1217 | add_task = NULL; |
1218 | } | 1218 | } |
1219 | GNUNET_CONTAINER_multipeermap_iterate (peers, &free_peer, NULL); | 1219 | GNUNET_CONTAINER_multipeermap_iterate (peers, &free_peer, NULL); |
1220 | GNUNET_CONTAINER_multipeermap_destroy (peers); | 1220 | GNUNET_CONTAINER_multipeermap_destroy (peers); |