GNUNET_MQ_get_last_envelope: return tail or current
authorGabor X Toth <*@tg-x.net>
Fri, 19 Aug 2016 19:58:24 +0000 (19:58 +0000)
committerGabor X Toth <*@tg-x.net>
Fri, 19 Aug 2016 19:58:24 +0000 (19:58 +0000)
src/util/mq.c

index b971fdefd95214787d73a127c3fa5c978bc8b548..b22d97f593097ff0ceb419925ec75c572b51c581 100644 (file)
@@ -1096,7 +1096,10 @@ GNUNET_MQ_get_current_envelope (struct GNUNET_MQ_Handle *mq)
 struct GNUNET_MQ_Envelope *
 GNUNET_MQ_get_last_envelope (struct GNUNET_MQ_Handle *mq)
 {
-  return mq->envelope_tail;
+  if (NULL != mq->envelope_tail)
+    return mq->envelope_tail;
+
+  return mq->current_envelope;
 }