aboutsummaryrefslogtreecommitdiff
path: root/src/util/client.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
commit29e6158507a0758192075ac6ece7ba8e75ddc49a (patch)
treeb91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/util/client.c
parent5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff)
downloadgnunet-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/util/client.c')
-rw-r--r--src/util/client.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/util/client.c b/src/util/client.c
index d87be74f6..f93fd1d10 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -579,11 +579,9 @@ receive_helper (void *cls,
579 * Continuation to call the receive callback. 579 * Continuation to call the receive callback.
580 * 580 *
581 * @param cls our handle to the client connection 581 * @param cls our handle to the client connection
582 * @param tc scheduler context
583 */ 582 */
584static void 583static void
585receive_task (void *cls, 584receive_task (void *cls)
586 const struct GNUNET_SCHEDULER_TaskContext *tc)
587{ 585{
588 struct GNUNET_CLIENT_Connection *client = cls; 586 struct GNUNET_CLIENT_Connection *client = cls;
589 GNUNET_CLIENT_MessageHandler handler = client->receiver_handler; 587 GNUNET_CLIENT_MessageHandler handler = client->receiver_handler;
@@ -746,11 +744,9 @@ GNUNET_CLIENT_service_test_cancel (struct GNUNET_CLIENT_TestHandle *th)
746 * and then cleans up. 744 * and then cleans up.
747 * 745 *
748 * @param cls the `struct GNUNET_CLIENT_TestHandle` 746 * @param cls the `struct GNUNET_CLIENT_TestHandle`
749 * @param tc scheduler context
750 */ 747 */
751static void 748static void
752report_result (void *cls, 749report_result (void *cls)
753 const struct GNUNET_SCHEDULER_TaskContext *tc)
754{ 750{
755 struct GNUNET_CLIENT_TestHandle *th = cls; 751 struct GNUNET_CLIENT_TestHandle *th = cls;
756 752
@@ -1080,16 +1076,16 @@ client_notify (void *cls, size_t size, void *buf);
1080 * service after a while. 1076 * service after a while.
1081 * 1077 *
1082 * @param cls our `struct GNUNET_CLIENT_TransmitHandle` of the request 1078 * @param cls our `struct GNUNET_CLIENT_TransmitHandle` of the request
1083 * @param tc unused
1084 */ 1079 */
1085static void 1080static void
1086client_delayed_retry (void *cls, 1081client_delayed_retry (void *cls)
1087 const struct GNUNET_SCHEDULER_TaskContext *tc)
1088{ 1082{
1089 struct GNUNET_CLIENT_TransmitHandle *th = cls; 1083 struct GNUNET_CLIENT_TransmitHandle *th = cls;
1084 const struct GNUNET_SCHEDULER_TaskContext *tc;
1090 struct GNUNET_TIME_Relative delay; 1085 struct GNUNET_TIME_Relative delay;
1091 1086
1092 th->reconnect_task = NULL; 1087 th->reconnect_task = NULL;
1088 tc = GNUNET_SCHEDULER_get_task_context ();
1093 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1089 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1094 { 1090 {
1095 /* give up, was shutdown */ 1091 /* give up, was shutdown */
@@ -1153,11 +1149,14 @@ client_notify (void *cls,
1153 struct GNUNET_CLIENT_Connection *client = th->client; 1149 struct GNUNET_CLIENT_Connection *client = th->client;
1154 size_t ret; 1150 size_t ret;
1155 struct GNUNET_TIME_Relative delay; 1151 struct GNUNET_TIME_Relative delay;
1152 const struct GNUNET_SCHEDULER_TaskContext *tc;
1153
1156 1154
1157 LOG (GNUNET_ERROR_TYPE_DEBUG, 1155 LOG (GNUNET_ERROR_TYPE_DEBUG,
1158 "client_notify is running\n"); 1156 "client_notify is running\n");
1159 th->th = NULL; 1157 th->th = NULL;
1160 client->th = NULL; 1158 client->th = NULL;
1159 tc = GNUNET_SCHEDULER_get_task_context ();
1161 if (NULL == buf) 1160 if (NULL == buf)
1162 { 1161 {
1163 delay = GNUNET_TIME_absolute_get_remaining (th->timeout); 1162 delay = GNUNET_TIME_absolute_get_remaining (th->timeout);
@@ -1165,7 +1164,7 @@ client_notify (void *cls,
1165 if ( (GNUNET_YES != th->auto_retry) || 1164 if ( (GNUNET_YES != th->auto_retry) ||
1166 (0 == --th->attempts_left) || 1165 (0 == --th->attempts_left) ||
1167 (delay.rel_value_us < 1)|| 1166 (delay.rel_value_us < 1)||
1168 (0 != (GNUNET_SCHEDULER_get_reason() & GNUNET_SCHEDULER_REASON_SHUTDOWN))) 1167 (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)))
1169 { 1168 {
1170 LOG (GNUNET_ERROR_TYPE_DEBUG, 1169 LOG (GNUNET_ERROR_TYPE_DEBUG,
1171 "Transmission failed %u times, giving up.\n", 1170 "Transmission failed %u times, giving up.\n",