From: Christian Grothoff Date: Sun, 29 Oct 2017 10:24:52 +0000 (+0100) Subject: better logging of message processing errors in mq handling X-Git-Tag: gnunet-0.11.0rc0~48^2~1^2~37 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e1e838cdb804ed54aedccf5fce030ecc066028cd;p=oweals%2Fgnunet.git better logging of message processing errors in mq handling --- diff --git a/src/util/mq.c b/src/util/mq.c index c7ed5330e..6ad6b82eb 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -221,8 +221,10 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, uint16_t mtype = ntohs (mh->type); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received message of type %u and size %u\n", - mtype, msize); + "Queue %p received message of type %u and size %u\n", + mq, + mtype, + msize); if (NULL == mq->handlers) goto done; @@ -359,7 +361,8 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, mq->current_envelope = ev; GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "mq: sending message of type %u, queue empty\n", ntohs(ev->mh->type)); + "mq: sending message of type %u, queue empty\n", + ntohs(ev->mh->type)); mq->send_impl (mq, ev->mh, @@ -848,6 +851,9 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) ev); GNUNET_assert (0 < mq->queue_length); mq->queue_length--; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "MQ destroy drops message of type %u\n", + ntohs (ev->mh->type)); GNUNET_MQ_discard (ev); } if (NULL != mq->current_envelope) @@ -855,6 +861,9 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) /* we can only discard envelopes that * are not queued! */ mq->current_envelope->parent_queue = NULL; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "MQ destroy drops message of type %u\n", + ntohs (mq->current_envelope->mh->type)); GNUNET_MQ_discard (mq->current_envelope); mq->current_envelope = NULL; GNUNET_assert (0 < mq->queue_length); diff --git a/src/util/mst.c b/src/util/mst.c index 0d90c5d10..4c2a74212 100644 --- a/src/util/mst.c +++ b/src/util/mst.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2010, 2016 GNUnet e.V. + Copyright (C) 2010, 2016, 2017 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -229,9 +229,15 @@ do_align: if (one_shot == GNUNET_YES) one_shot = GNUNET_SYSERR; mst->off += want; - if (GNUNET_SYSERR == mst->cb (mst->cb_cls, - hdr)) + if (GNUNET_SYSERR == mst->cb (mst->cb_cls, + hdr)) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failure processing message of type %u and size %u\n", + ntohs (hdr->type), + ntohs (hdr->size)); return GNUNET_SYSERR; + } if (mst->off == mst->pos) { /* reset to beginning of buffer, it's free right now! */ @@ -273,7 +279,13 @@ do_align: one_shot = GNUNET_SYSERR; if (GNUNET_SYSERR == mst->cb (mst->cb_cls, hdr)) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failure processing message of type %u and size %u\n", + ntohs (hdr->type), + ntohs (hdr->size)); return GNUNET_SYSERR; + } buf += want; size -= want; }