diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-22 00:46:03 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-22 00:46:03 +0100 |
commit | 7e9e4e320d6eee5bf6afd876b282609712cb72db (patch) | |
tree | eda9315b99a026c9033d2db0ed7993d4e524700d /src/nse | |
parent | 542bf871c6eebdc645884960559e15ce400939e6 (diff) | |
download | gnunet-7e9e4e320d6eee5bf6afd876b282609712cb72db.tar.gz gnunet-7e9e4e320d6eee5bf6afd876b282609712cb72db.zip |
use new SCHEDULER_add_at API where applicable
Diffstat (limited to 'src/nse')
-rw-r--r-- | src/nse/gnunet-service-nse.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 4d54a740b..e35115e31 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -437,7 +437,7 @@ handle_start (void *cls, | |||
437 | GNUNET_notification_context_add (nc, | 437 | GNUNET_notification_context_add (nc, |
438 | mq); | 438 | mq); |
439 | setup_estimate_message (&em); | 439 | setup_estimate_message (&em); |
440 | env = GNUNET_MQ_msg_copy (&em.header); | 440 | env = GNUNET_MQ_msg_copy (&em.header); |
441 | GNUNET_MQ_send (mq, | 441 | GNUNET_MQ_send (mq, |
442 | env); | 442 | env); |
443 | GNUNET_SERVICE_client_continue (client); | 443 | GNUNET_SERVICE_client_continue (client); |
@@ -607,14 +607,14 @@ transmit_task_cb (void *cls) | |||
607 | struct NSEPeerEntry *peer_entry = cls; | 607 | struct NSEPeerEntry *peer_entry = cls; |
608 | unsigned int idx; | 608 | unsigned int idx; |
609 | struct GNUNET_MQ_Envelope *env; | 609 | struct GNUNET_MQ_Envelope *env; |
610 | 610 | ||
611 | peer_entry->transmit_task = NULL; | 611 | peer_entry->transmit_task = NULL; |
612 | idx = estimate_index; | 612 | idx = estimate_index; |
613 | if (GNUNET_NO == peer_entry->previous_round) | 613 | if (GNUNET_NO == peer_entry->previous_round) |
614 | { | 614 | { |
615 | idx = (idx + HISTORY_SIZE - 1) % HISTORY_SIZE; | 615 | idx = (idx + HISTORY_SIZE - 1) % HISTORY_SIZE; |
616 | peer_entry->previous_round = GNUNET_YES; | 616 | peer_entry->previous_round = GNUNET_YES; |
617 | peer_entry->transmit_task | 617 | peer_entry->transmit_task |
618 | = GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), | 618 | = GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), |
619 | &transmit_task_cb, | 619 | &transmit_task_cb, |
620 | peer_entry); | 620 | peer_entry); |
@@ -652,12 +652,12 @@ transmit_task_cb (void *cls) | |||
652 | GNUNET_NO); | 652 | GNUNET_NO); |
653 | #if ENABLE_NSE_HISTOGRAM | 653 | #if ENABLE_NSE_HISTOGRAM |
654 | peer_entry->transmitted_messages++; | 654 | peer_entry->transmitted_messages++; |
655 | peer_entry->last_transmitted_size | 655 | peer_entry->last_transmitted_size |
656 | = ntohl(size_estimate_messages[idx].matching_bits); | 656 | = ntohl(size_estimate_messages[idx].matching_bits); |
657 | #endif | 657 | #endif |
658 | env = GNUNET_MQ_msg_copy (&size_estimate_messages[idx].header); | 658 | env = GNUNET_MQ_msg_copy (&size_estimate_messages[idx].header); |
659 | GNUNET_MQ_send (peer_entry->mq, | 659 | GNUNET_MQ_send (peer_entry->mq, |
660 | env); | 660 | env); |
661 | } | 661 | } |
662 | 662 | ||
663 | 663 | ||
@@ -811,11 +811,10 @@ update_flood_message (void *cls) | |||
811 | GNUNET_CONTAINER_multipeermap_iterate (peers, | 811 | GNUNET_CONTAINER_multipeermap_iterate (peers, |
812 | &schedule_current_round, | 812 | &schedule_current_round, |
813 | NULL); | 813 | NULL); |
814 | flood_task = | 814 | flood_task |
815 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining | 815 | = GNUNET_SCHEDULER_add_at (next_timestamp, |
816 | (next_timestamp), | 816 | &update_flood_message, |
817 | &update_flood_message, | 817 | NULL); |
818 | NULL); | ||
819 | } | 818 | } |
820 | 819 | ||
821 | 820 | ||
@@ -1012,7 +1011,7 @@ update_flood_times (void *cls, | |||
1012 | { | 1011 | { |
1013 | /* still stuck in previous round, no point to update, check that | 1012 | /* still stuck in previous round, no point to update, check that |
1014 | * we are active here though... */ | 1013 | * we are active here though... */ |
1015 | if (NULL == peer_entry->transmit_task) | 1014 | if (NULL == peer_entry->transmit_task) |
1016 | { | 1015 | { |
1017 | GNUNET_break (0); | 1016 | GNUNET_break (0); |
1018 | } | 1017 | } |
@@ -1034,7 +1033,7 @@ update_flood_times (void *cls, | |||
1034 | /** | 1033 | /** |
1035 | * Core handler for size estimate flooding messages. | 1034 | * Core handler for size estimate flooding messages. |
1036 | * | 1035 | * |
1037 | * @param cls peer this message is from | 1036 | * @param cls peer this message is from |
1038 | * @param incoming_flood received message | 1037 | * @param incoming_flood received message |
1039 | */ | 1038 | */ |
1040 | static void | 1039 | static void |
@@ -1169,7 +1168,7 @@ handle_p2p_estimate (void *cls, | |||
1169 | /* push back our result now, that peer is spreading bad information... */ | 1168 | /* push back our result now, that peer is spreading bad information... */ |
1170 | if (NULL != peer_entry->transmit_task) | 1169 | if (NULL != peer_entry->transmit_task) |
1171 | GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); | 1170 | GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); |
1172 | peer_entry->transmit_task | 1171 | peer_entry->transmit_task |
1173 | = GNUNET_SCHEDULER_add_now (&transmit_task_cb, | 1172 | = GNUNET_SCHEDULER_add_now (&transmit_task_cb, |
1174 | peer_entry); | 1173 | peer_entry); |
1175 | /* Not closer than our most recent message, no need to do work here */ | 1174 | /* Not closer than our most recent message, no need to do work here */ |
@@ -1431,11 +1430,10 @@ core_init (void *cls, | |||
1431 | current_timestamp); | 1430 | current_timestamp); |
1432 | estimate_count++; | 1431 | estimate_count++; |
1433 | } | 1432 | } |
1434 | flood_task = | 1433 | flood_task |
1435 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining | 1434 | = GNUNET_SCHEDULER_add_at (next_timestamp, |
1436 | (next_timestamp), | 1435 | &update_flood_message, |
1437 | &update_flood_message, | 1436 | NULL); |
1438 | NULL); | ||
1439 | } | 1437 | } |
1440 | 1438 | ||
1441 | 1439 | ||