From: Gabor X Toth <*@tg-x.net> Date: Wed, 17 Aug 2016 22:28:47 +0000 (+0000) Subject: GNUNET_MQ_get_last_envelope() X-Git-Tag: initial-import-from-subversion-38251~376 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4f51ef196f6dff91fd83085462fd9c4624f7296b;p=oweals%2Fgnunet.git GNUNET_MQ_get_last_envelope() --- diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index 8f0c6ee3f..d383adbb5 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h @@ -434,8 +434,8 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm); /** - * Function to obtain the current envelope from - * within #GNUNET_MQ_SendImpl implementations. + * Function to obtain the current envelope + * from within #GNUNET_MQ_SendImpl implementations. * * @param mq message queue to interrogate * @return the current envelope @@ -444,6 +444,16 @@ struct GNUNET_MQ_Envelope * GNUNET_MQ_get_current_envelope (struct GNUNET_MQ_Handle *mq); +/** + * Function to obtain the last envelope in the queue. + * + * @param mq message queue to interrogate + * @return the last envelope in the queue + */ +struct GNUNET_MQ_Envelope * +GNUNET_MQ_get_last_envelope (struct GNUNET_MQ_Handle *mq); + + /** * Set application-specific options for this envelope. * Overrides the options set for the queue with diff --git a/src/util/mq.c b/src/util/mq.c index bea5eb304..b971fdefd 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -82,7 +82,7 @@ struct GNUNET_MQ_Envelope * Did the application call #GNUNET_MQ_env_set_options()? */ int have_custom_options; - + }; @@ -159,7 +159,7 @@ struct GNUNET_MQ_Handle * #GNUNET_MQ_set_options(). Default is 0. */ const void *default_extra; - + /** * Flags that were set for this queue by * #GNUNET_MQ_set_options(). Default is 0. @@ -1074,8 +1074,8 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) /** - * Function to obtain the current envelope from - * within #GNUNET_MQ_SendImpl implementations. + * Function to obtain the current envelope + * from within #GNUNET_MQ_SendImpl implementations. * * @param mq message queue to interrogate * @return the current envelope @@ -1087,6 +1087,19 @@ GNUNET_MQ_get_current_envelope (struct GNUNET_MQ_Handle *mq) } +/** + * Function to obtain the last envelope in the queue. + * + * @param mq message queue to interrogate + * @return the last envelope in the queue + */ +struct GNUNET_MQ_Envelope * +GNUNET_MQ_get_last_envelope (struct GNUNET_MQ_Handle *mq) +{ + return mq->envelope_tail; +} + + /** * Set application-specific options for this envelope. * Overrides the options set for the queue with @@ -1119,7 +1132,7 @@ GNUNET_MQ_env_get_options (struct GNUNET_MQ_Envelope *env, uint64_t *flags) { struct GNUNET_MQ_Handle *mq = env->parent_queue; - + if (GNUNET_YES == env->have_custom_options) { *flags = env->flags;