dovecot-2.2: lib-http: client: Fixed crash occurring sometimes w...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 30 20:50:25 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/3773fec28b4d
changeset: 17851:3773fec28b4d
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Sep 30 23:49:45 2014 +0300
description:
lib-http: client: Fixed crash occurring sometimes when delay timeout expired.
Forgot to drop destroyed requests from delay queue.

diffstat:

 src/lib-http/http-client-queue.c   |  15 ++++++++++++++-
 src/lib-http/http-client-request.c |   3 +++
 2 files changed, 17 insertions(+), 1 deletions(-)

diffs (46 lines):

diff -r 4c18abbf8b94 -r 3773fec28b4d src/lib-http/http-client-queue.c
--- a/src/lib-http/http-client-queue.c	Tue Sep 30 23:49:35 2014 +0300
+++ b/src/lib-http/http-client-queue.c	Tue Sep 30 23:49:45 2014 +0300
@@ -144,15 +144,28 @@
 http_client_queue_drop_request(struct http_client_queue *queue,
 	struct http_client_request *req)
 {
-	ARRAY_TYPE(http_client_request) *req_arr = &queue->request_queue;
+	ARRAY_TYPE(http_client_request) *req_arr;
 	struct http_client_request **req_idx;
 
+	/* remove from main queue */
+	req_arr = &queue->request_queue;
 	array_foreach_modifiable(req_arr, req_idx) {
 		if (*req_idx == req) {
 			array_delete(req_arr, array_foreach_idx(req_arr, req_idx), 1);
 			break;
 		}
 	}
+
+	/* remove from delay queue */
+	if (req->release_time.tv_sec > 0) {
+		req_arr = &queue->delayed_request_queue;
+		array_foreach_modifiable(req_arr, req_idx) {
+			if (*req_idx == req) {
+				array_delete(req_arr, array_foreach_idx(req_arr, req_idx), 1);
+				break;
+			}
+		}
+	}
 }
 
 static bool
diff -r 4c18abbf8b94 -r 3773fec28b4d src/lib-http/http-client-request.c
--- a/src/lib-http/http-client-request.c	Tue Sep 30 23:49:35 2014 +0300
+++ b/src/lib-http/http-client-request.c	Tue Sep 30 23:49:45 2014 +0300
@@ -163,6 +163,9 @@
 	http_client_request_debug(req, "Destroy (requests left=%d)",
 		client->pending_requests);
 
+	if (req->queue != NULL)
+		http_client_queue_drop_request(req->queue, req);
+
 	if (client->pending_requests == 0 && client->ioloop != NULL)
 		io_loop_stop(client->ioloop);
 


More information about the dovecot-cvs mailing list