From: Stephan Bosch Date: Thu, 23 Oct 2014 02:55:51 +0000 (+0300) Subject: lib-http: client: Assertion in http_client_queue_fail() was wrong. X-Git-Tag: 2.2.15~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8304588757ef197bf10461f668cb017cb75a68a;p=thirdparty%2Fdovecot%2Fcore.git 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. --- diff --git a/src/lib-http/http-client-queue.c b/src/lib-http/http-client-queue.c index 55c178ba33..1aa348bdff 100644 --- a/src/lib-http/http-client-queue.c +++ b/src/lib-http/http-client-queue.c @@ -151,10 +151,12 @@ void http_client_queue_fail(struct http_client_queue *queue, } 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)); } /*