From d0bb14e2a958f4f816c6c006dd8b7a979e6de289 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 17 Jan 2017 11:22:00 +0100 Subject: replace redundant MQ_NotifyCallback by SCHEDULER_TaskCallback --- src/include/gnunet_mq_lib.h | 11 +---------- src/include/gnunet_peerinfo_service.h | 2 +- src/multicast/multicast_api.c | 2 +- src/peerinfo/peerinfo_api.c | 2 +- src/psyc/psyc_api.c | 2 +- src/social/social_api.c | 4 ++-- src/util/mq.c | 22 +++++++++++----------- 7 files changed, 18 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index 5c2f808df..108ba5d54 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h @@ -254,15 +254,6 @@ typedef void void *impl_state); -/** - * Callback used for notifications - * - * @param cls closure - */ -typedef void -(*GNUNET_MQ_NotifyCallback) (void *cls); - - /** * Generic error handler, called with the appropriate * error code and the same closure specified at the creation of @@ -634,7 +625,7 @@ GNUNET_MQ_set_handlers_closure (struct GNUNET_MQ_Handle *mq, */ void GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *ev, - GNUNET_MQ_NotifyCallback cb, + GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls); diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h index 44df483a0..b5c2153ac 100644 --- a/src/include/gnunet_peerinfo_service.h +++ b/src/include/gnunet_peerinfo_service.h @@ -101,7 +101,7 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h); struct GNUNET_MQ_Envelope * GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, const struct GNUNET_HELLO_Message *hello, - GNUNET_MQ_NotifyCallback cont, + GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls); diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c index 6e5402b28..a8b1dee40 100644 --- a/src/multicast/multicast_api.c +++ b/src/multicast/multicast_api.c @@ -556,7 +556,7 @@ group_disconnect (struct GNUNET_MULTICAST_Group *grp, if (NULL != last) { GNUNET_MQ_notify_sent (last, - (GNUNET_MQ_NotifyCallback) group_cleanup, grp); + (GNUNET_SCHEDULER_TaskCallback) group_cleanup, grp); } else { diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 10729f3d0..b75d4e291 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c @@ -557,7 +557,7 @@ GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic) struct GNUNET_MQ_Envelope * GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, const struct GNUNET_HELLO_Message *hello, - GNUNET_MQ_NotifyCallback cont, + GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls) { struct GNUNET_MQ_Envelope *env; diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c index d744e7d08..c6544df3a 100644 --- a/src/psyc/psyc_api.c +++ b/src/psyc/psyc_api.c @@ -598,7 +598,7 @@ channel_disconnect (struct GNUNET_PSYC_Channel *chn, struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (chn->mq); if (NULL != env) { - GNUNET_MQ_notify_sent (env, (GNUNET_MQ_NotifyCallback) channel_cleanup, chn); + GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) channel_cleanup, chn); } else { diff --git a/src/social/social_api.c b/src/social/social_api.c index 82928a258..a7fe0916f 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c @@ -1087,7 +1087,7 @@ place_disconnect (struct GNUNET_SOCIAL_Place *plc, struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq); if (NULL != env) { - GNUNET_MQ_notify_sent (env, (GNUNET_MQ_NotifyCallback) place_cleanup, plc); + GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) place_cleanup, plc); } else { @@ -2701,7 +2701,7 @@ GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (app->mq); if (NULL != env) { - GNUNET_MQ_notify_sent (env, (GNUNET_MQ_NotifyCallback) app_cleanup, app); + GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) app_cleanup, app); } else { diff --git a/src/util/mq.c b/src/util/mq.c index ae13ff601..985e86331 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -58,7 +58,7 @@ struct GNUNET_MQ_Envelope /** * Called after the message was sent irrevocably. */ - GNUNET_MQ_NotifyCallback sent_cb; + GNUNET_SCHEDULER_TaskCallback sent_cb; /** * Closure for @e send_cb @@ -128,10 +128,10 @@ struct GNUNET_MQ_Handle void *error_handler_cls; /** - * Task to asynchronously run #impl_send_continue(). + * Task to asynchronously run #impl_send_continue(). */ struct GNUNET_SCHEDULER_Task *send_task; - + /** * Linked list of messages pending to be sent */ @@ -414,7 +414,7 @@ static void impl_send_continue (void *cls) { struct GNUNET_MQ_Handle *mq = cls; - + mq->send_task = NULL; /* call is only valid if we're actually currently sending * a message */ @@ -441,8 +441,8 @@ void GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq) { struct GNUNET_MQ_Envelope *current_envelope; - GNUNET_MQ_NotifyCallback cb; - + GNUNET_SCHEDULER_TaskCallback cb; + GNUNET_assert (0 < mq->queue_length); mq->queue_length--; mq->in_flight = GNUNET_NO; @@ -456,7 +456,7 @@ GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq) { current_envelope->sent_cb = NULL; cb (current_envelope->sent_cls); - } + } GNUNET_free (current_envelope); } @@ -475,8 +475,8 @@ void GNUNET_MQ_impl_send_in_flight (struct GNUNET_MQ_Handle *mq) { struct GNUNET_MQ_Envelope *current_envelope; - GNUNET_MQ_NotifyCallback cb; - + GNUNET_SCHEDULER_TaskCallback cb; + mq->in_flight = GNUNET_YES; /* call is only valid if we're actually currently sending * a message */ @@ -812,7 +812,7 @@ GNUNET_MQ_assoc_remove (struct GNUNET_MQ_Handle *mq, */ void GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *mqm, - GNUNET_MQ_NotifyCallback cb, + GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls) { mqm->sent_cb = cb; @@ -953,7 +953,7 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) GNUNET_assert (NULL != mq); GNUNET_assert (NULL != mq->cancel_impl); - + mq->evacuate_called = GNUNET_NO; if (mq->current_envelope == ev) -- cgit v1.2.3