diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-18 18:59:01 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-18 19:00:18 +0100 |
commit | 6fa8e1c652f447ebd94e144314ce55412dab80c8 (patch) | |
tree | 14fb8d9a5f221d106ae8e2b2244aa859a7a7314e /src/util | |
parent | 0af32e03677ab1c8a819b376c8fa026d0ffa9144 (diff) | |
download | gnunet-6fa8e1c652f447ebd94e144314ce55412dab80c8.tar.gz gnunet-6fa8e1c652f447ebd94e144314ce55412dab80c8.zip |
logging fixes, nicer comments
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/client.c | 2 | ||||
-rw-r--r-- | src/util/mq.c | 17 | ||||
-rw-r--r-- | src/util/mst.c | 8 |
3 files changed, 12 insertions, 15 deletions
diff --git a/src/util/client.c b/src/util/client.c index 1cf819f9d..06f6ebc32 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -879,4 +879,4 @@ GNUNET_CLIENT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
879 | return cstate->mq; | 879 | return cstate->mq; |
880 | } | 880 | } |
881 | 881 | ||
882 | /* end of client_new.c */ | 882 | /* end of client.c */ |
diff --git a/src/util/mq.c b/src/util/mq.c index 265e4744b..43926ed64 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -368,6 +368,7 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, | |||
368 | ev); | 368 | ev); |
369 | return; | 369 | return; |
370 | } | 370 | } |
371 | GNUNET_assert (NULL == mq->envelope_head); | ||
371 | mq->current_envelope = ev; | 372 | mq->current_envelope = ev; |
372 | mq->send_impl (mq, | 373 | mq->send_impl (mq, |
373 | ev->mh, | 374 | ev->mh, |
@@ -960,20 +961,16 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) | |||
960 | 961 | ||
961 | if (mq->current_envelope == ev) | 962 | if (mq->current_envelope == ev) |
962 | { | 963 | { |
963 | // complex case, we already started with transmitting | 964 | /* complex case, we already started with transmitting |
964 | // the message | 965 | the message using the callbacks. */ |
965 | GNUNET_assert (0 < mq->queue_length); | 966 | GNUNET_assert (0 < mq->queue_length); |
966 | mq->queue_length--; | 967 | mq->queue_length--; |
967 | mq->cancel_impl (mq, | 968 | mq->cancel_impl (mq, |
968 | mq->impl_state); | 969 | mq->impl_state); |
969 | // continue sending the next message, if any | 970 | /* continue sending the next message, if any */ |
970 | if (NULL == mq->envelope_head) | 971 | mq->current_envelope = mq->envelope_head; |
972 | if (NULL != mq->current_envelope) | ||
971 | { | 973 | { |
972 | mq->current_envelope = NULL; | ||
973 | } | ||
974 | else | ||
975 | { | ||
976 | mq->current_envelope = mq->envelope_head; | ||
977 | GNUNET_CONTAINER_DLL_remove (mq->envelope_head, | 974 | GNUNET_CONTAINER_DLL_remove (mq->envelope_head, |
978 | mq->envelope_tail, | 975 | mq->envelope_tail, |
979 | mq->current_envelope); | 976 | mq->current_envelope); |
@@ -984,7 +981,7 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) | |||
984 | } | 981 | } |
985 | else | 982 | else |
986 | { | 983 | { |
987 | // simple case, message is still waiting in the queue | 984 | /* simple case, message is still waiting in the queue */ |
988 | GNUNET_CONTAINER_DLL_remove (mq->envelope_head, | 985 | GNUNET_CONTAINER_DLL_remove (mq->envelope_head, |
989 | mq->envelope_tail, | 986 | mq->envelope_tail, |
990 | ev); | 987 | ev); |
diff --git a/src/util/mst.c b/src/util/mst.c index 82a21b880..1422c248e 100644 --- a/src/util/mst.c +++ b/src/util/mst.c | |||
@@ -130,7 +130,7 @@ GNUNET_MST_from_buffer (struct GNUNET_MessageStreamTokenizer *mst, | |||
130 | GNUNET_assert (mst->off <= mst->pos); | 130 | GNUNET_assert (mst->off <= mst->pos); |
131 | GNUNET_assert (mst->pos <= mst->curr_buf); | 131 | GNUNET_assert (mst->pos <= mst->curr_buf); |
132 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 132 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
133 | "Server-mst receives %u bytes with %u bytes already in private buffer\n", | 133 | "MST receives %u bytes with %u bytes already in private buffer\n", |
134 | (unsigned int) size, | 134 | (unsigned int) size, |
135 | (unsigned int) (mst->pos - mst->off)); | 135 | (unsigned int) (mst->pos - mst->off)); |
136 | ret = GNUNET_OK; | 136 | ret = GNUNET_OK; |
@@ -151,7 +151,7 @@ do_align: | |||
151 | } | 151 | } |
152 | if (mst->pos - mst->off < sizeof (struct GNUNET_MessageHeader)) | 152 | if (mst->pos - mst->off < sizeof (struct GNUNET_MessageHeader)) |
153 | { | 153 | { |
154 | delta | 154 | delta |
155 | = GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) | 155 | = GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) |
156 | - (mst->pos - mst->off), | 156 | - (mst->pos - mst->off), |
157 | size); | 157 | size); |
@@ -229,8 +229,8 @@ do_align: | |||
229 | if (one_shot == GNUNET_YES) | 229 | if (one_shot == GNUNET_YES) |
230 | one_shot = GNUNET_SYSERR; | 230 | one_shot = GNUNET_SYSERR; |
231 | mst->off += want; | 231 | mst->off += want; |
232 | if (GNUNET_SYSERR == mst->cb (mst->cb_cls, | 232 | if (GNUNET_SYSERR == mst->cb (mst->cb_cls, |
233 | hdr)) | 233 | hdr)) |
234 | return GNUNET_SYSERR; | 234 | return GNUNET_SYSERR; |
235 | if (mst->off == mst->pos) | 235 | if (mst->off == mst->pos) |
236 | { | 236 | { |