diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
commit | 29e6158507a0758192075ac6ece7ba8e75ddc49a (patch) | |
tree | b91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/peerinfo | |
parent | 5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff) | |
download | gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.tar.gz gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.zip |
small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context()
Diffstat (limited to 'src/peerinfo')
-rw-r--r-- | src/peerinfo/gnunet-service-peerinfo.c | 16 | ||||
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 8 | ||||
-rw-r--r-- | src/peerinfo/peerinfo_api_notify.c | 7 | ||||
-rw-r--r-- | src/peerinfo/test_peerinfo_api_notify_friend_only.c | 7 |
4 files changed, 16 insertions, 22 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 456a3546b..a0defb8cc 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -651,15 +651,15 @@ hosts_directory_scan_callback (void *cls, | |||
651 | * Call this method periodically to scan data/hosts for new hosts. | 651 | * Call this method periodically to scan data/hosts for new hosts. |
652 | * | 652 | * |
653 | * @param cls unused | 653 | * @param cls unused |
654 | * @param tc scheduler context, aborted if reason is shutdown | ||
655 | */ | 654 | */ |
656 | static void | 655 | static void |
657 | cron_scan_directory_data_hosts (void *cls, | 656 | cron_scan_directory_data_hosts (void *cls) |
658 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
659 | { | 657 | { |
660 | static unsigned int retries; | 658 | static unsigned int retries; |
661 | struct DirScanContext dsc; | 659 | struct DirScanContext dsc; |
660 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
662 | 661 | ||
662 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
663 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 663 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
664 | return; | 664 | return; |
665 | if (GNUNET_SYSERR == GNUNET_DISK_directory_create (networkIdDirectory)) | 665 | if (GNUNET_SYSERR == GNUNET_DISK_directory_create (networkIdDirectory)) |
@@ -1041,14 +1041,14 @@ discard_hosts_helper (void *cls, | |||
1041 | * HELLOs to expire. | 1041 | * HELLOs to expire. |
1042 | * | 1042 | * |
1043 | * @param cls unused | 1043 | * @param cls unused |
1044 | * @param tc scheduler context, aborted if reason is shutdown | ||
1045 | */ | 1044 | */ |
1046 | static void | 1045 | static void |
1047 | cron_clean_data_hosts (void *cls, | 1046 | cron_clean_data_hosts (void *cls) |
1048 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1049 | { | 1047 | { |
1050 | struct GNUNET_TIME_Absolute now; | 1048 | struct GNUNET_TIME_Absolute now; |
1049 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
1051 | 1050 | ||
1051 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
1052 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1052 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1053 | return; | 1053 | return; |
1054 | now = GNUNET_TIME_absolute_get (); | 1054 | now = GNUNET_TIME_absolute_get (); |
@@ -1277,11 +1277,9 @@ free_host_entry (void *cls, | |||
1277 | * Clean up our state. Called during shutdown. | 1277 | * Clean up our state. Called during shutdown. |
1278 | * | 1278 | * |
1279 | * @param cls unused | 1279 | * @param cls unused |
1280 | * @param tc scheduler task context, unused | ||
1281 | */ | 1280 | */ |
1282 | static void | 1281 | static void |
1283 | shutdown_task (void *cls, | 1282 | shutdown_task (void *cls) |
1284 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1285 | { | 1283 | { |
1286 | struct NotificationContext *cur; | 1284 | struct NotificationContext *cur; |
1287 | struct NotificationContext *next; | 1285 | struct NotificationContext *next; |
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index c8b85e94c..ad4576fc2 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -279,11 +279,9 @@ reconnect (struct GNUNET_PEERINFO_Handle *h); | |||
279 | * Task scheduled to re-try connecting to the peerinfo service. | 279 | * Task scheduled to re-try connecting to the peerinfo service. |
280 | * | 280 | * |
281 | * @param cls the `struct GNUNET_PEERINFO_Handle *` | 281 | * @param cls the `struct GNUNET_PEERINFO_Handle *` |
282 | * @param tc scheduler context | ||
283 | */ | 282 | */ |
284 | static void | 283 | static void |
285 | reconnect_task (void *cls, | 284 | reconnect_task (void *cls) |
286 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
287 | { | 285 | { |
288 | struct GNUNET_PEERINFO_Handle *h = cls; | 286 | struct GNUNET_PEERINFO_Handle *h = cls; |
289 | 287 | ||
@@ -698,11 +696,9 @@ iterator_start_receive (void *cls, | |||
698 | * Peerinfo iteration request has timed out. | 696 | * Peerinfo iteration request has timed out. |
699 | * | 697 | * |
700 | * @param cls the `struct GNUNET_PEERINFO_IteratorContext *` | 698 | * @param cls the `struct GNUNET_PEERINFO_IteratorContext *` |
701 | * @param tc scheduler context | ||
702 | */ | 699 | */ |
703 | static void | 700 | static void |
704 | signal_timeout (void *cls, | 701 | signal_timeout (void *cls) |
705 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
706 | { | 702 | { |
707 | struct GNUNET_PEERINFO_IteratorContext *ic = cls; | 703 | struct GNUNET_PEERINFO_IteratorContext *ic = cls; |
708 | GNUNET_PEERINFO_Processor cb; | 704 | GNUNET_PEERINFO_Processor cb; |
diff --git a/src/peerinfo/peerinfo_api_notify.c b/src/peerinfo/peerinfo_api_notify.c index 1b0974631..16331548d 100644 --- a/src/peerinfo/peerinfo_api_notify.c +++ b/src/peerinfo/peerinfo_api_notify.c | |||
@@ -99,11 +99,10 @@ receive_notifications (struct GNUNET_PEERINFO_NotifyContext *nc); | |||
99 | /** | 99 | /** |
100 | * Task to re-try connecting to peerinfo. | 100 | * Task to re-try connecting to peerinfo. |
101 | * | 101 | * |
102 | * @param cls the 'struct GNUNET_PEERINFO_NotifyContext' | 102 | * @param cls the `struct GNUNET_PEERINFO_NotifyContext *` |
103 | * @param tc scheduler context | ||
104 | */ | 103 | */ |
105 | static void | 104 | static void |
106 | reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 105 | reconnect (void *cls) |
107 | { | 106 | { |
108 | struct GNUNET_PEERINFO_NotifyContext *nc = cls; | 107 | struct GNUNET_PEERINFO_NotifyContext *nc = cls; |
109 | 108 | ||
@@ -138,7 +137,7 @@ process_notification (void *cls, const struct GNUNET_MessageHeader *msg) | |||
138 | if (msg == NULL) | 137 | if (msg == NULL) |
139 | { | 138 | { |
140 | GNUNET_CLIENT_disconnect (nc->client); | 139 | GNUNET_CLIENT_disconnect (nc->client); |
141 | reconnect (nc, NULL); | 140 | reconnect (nc); |
142 | return; | 141 | return; |
143 | } | 142 | } |
144 | ms = ntohs (msg->size); | 143 | ms = ntohs (msg->size); |
diff --git a/src/peerinfo/test_peerinfo_api_notify_friend_only.c b/src/peerinfo/test_peerinfo_api_notify_friend_only.c index b3d5e4b6e..d0322713c 100644 --- a/src/peerinfo/test_peerinfo_api_notify_friend_only.c +++ b/src/peerinfo/test_peerinfo_api_notify_friend_only.c | |||
@@ -58,10 +58,10 @@ static int res_cb_wo_fo; | |||
58 | 58 | ||
59 | struct GNUNET_PeerIdentity pid; | 59 | struct GNUNET_PeerIdentity pid; |
60 | 60 | ||
61 | struct GNUNET_SCHEDULER_Task * timeout_task; | 61 | struct GNUNET_SCHEDULER_Task *timeout_task; |
62 | 62 | ||
63 | static void | 63 | static void |
64 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 64 | end_badly (void *cls) |
65 | { | 65 | { |
66 | timeout_task = NULL; | 66 | timeout_task = NULL; |
67 | GNUNET_break(0); | 67 | GNUNET_break(0); |
@@ -83,8 +83,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
83 | global_ret = 255; | 83 | global_ret = 255; |
84 | } | 84 | } |
85 | 85 | ||
86 | |||
86 | static void | 87 | static void |
87 | done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 88 | done (void *cls) |
88 | { | 89 | { |
89 | if (NULL != pnc_w_fo) | 90 | if (NULL != pnc_w_fo) |
90 | GNUNET_PEERINFO_notify_cancel (pnc_w_fo); | 91 | GNUNET_PEERINFO_notify_cancel (pnc_w_fo); |