dovecot-2.2: lib-http: client: Assertion in http_client_queue_fa...

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 23 02:56:51 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/e479bce0633b
changeset: 17985:e479bce0633b
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Thu Oct 23 05:55:51 2014 +0300
description:
lib-http: client: Assertion in http_client_queue_fail() was wrong.
It is not guaranteed that all queue lists are empty, because new requests
can be submitted from the callbacks. Changed this into a proper invariant
check, which asserts tbat the number of requests in sub-queues add up to
the total number in the main queue.

diffstat:

 src/lib-http/http-client-queue.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (20 lines):

diff -r bce536c20d32 -r e479bce0633b src/lib-http/http-client-queue.c
--- a/src/lib-http/http-client-queue.c	Thu Oct 23 05:55:51 2014 +0300
+++ b/src/lib-http/http-client-queue.c	Thu Oct 23 05:55:51 2014 +0300
@@ -151,10 +151,12 @@
 	}
 	array_clear(req_arr);
 
-	/* all queues must be empty now */
-	i_assert(array_count(&queue->delayed_requests) == 0);
-	i_assert(array_count(&queue->queued_requests) == 0);
-	i_assert(array_count(&queue->queued_urgent_requests) == 0);
+	/* all queues should be empty now... unless new requests were submitted
+	   from the callback. this invariant captures it all: */
+	i_assert((array_count(&queue->delayed_requests) +
+		array_count(&queue->queued_requests) +
+		array_count(&queue->queued_urgent_requests)) ==
+		array_count(&queue->requests));
 }
 
 /*


More information about the dovecot-cvs mailing list