From 99d028e9fe6e4ee9ab8c0b61002652d455358665 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Mon, 15 Dec 2014 07:17:53 +0000 Subject: [PATCH] - don't break if connection is empty (no messages to dequeue/call callback) --- src/cadet/gnunet-service-cadet_connection.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index ff2cb2730..ee96dddf8 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -212,7 +212,7 @@ struct CadetConnection /** * Pending message count. */ - int pending_messages; + unsigned int pending_messages; /** * Destroy flag: if true, destroy on last message. @@ -1270,6 +1270,7 @@ resend_messages_and_destroy (struct CadetConnection *c, int fwd) struct GNUNET_MessageHeader *out_msg; struct CadetTunnel *t = c->t; struct CadetPeer *neighbor; + unsigned int pending; int destroyed; c->state = CADET_CONNECTION_DESTROYED; @@ -1277,6 +1278,7 @@ resend_messages_and_destroy (struct CadetConnection *c, int fwd) destroyed = GNUNET_NO; neighbor = get_hop (c, fwd); + pending = c->pending_messages; while (NULL != (out_msg = GCP_connection_pop (neighbor, c, &destroyed))) { @@ -1290,9 +1292,12 @@ resend_messages_and_destroy (struct CadetConnection *c, int fwd) */ if (GNUNET_YES != destroyed) { - GNUNET_break (0); - GCC_debug (c, GNUNET_ERROR_TYPE_ERROR); - if (NULL != t) GCT_debug (t, GNUNET_ERROR_TYPE_ERROR); + if (0 != pending) + { + GNUNET_break (0); + GCC_debug (c, GNUNET_ERROR_TYPE_ERROR); + if (NULL != t) GCT_debug (t, GNUNET_ERROR_TYPE_ERROR); + } GCC_destroy (c); } } -- 2.25.1