dovecot-2.2: lib-http: http_client_deinit() calls any pending de...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 10 17:53:43 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/6466af800ed4
changeset: 16266:6466af800ed4
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 10 17:53:24 2013 +0300
description:
lib-http: http_client_deinit() calls any pending delayed failure callbacks.
diffstat:
src/lib-http/http-client-host.c | 9 +++++++-
src/lib-http/http-client-request.c | 40 +++++++++++++++++++------------------
2 files changed, 29 insertions(+), 20 deletions(-)
diffs (93 lines):
diff -r 286fa7f9538c -r 6466af800ed4 src/lib-http/http-client-host.c
--- a/src/lib-http/http-client-host.c Wed Apr 10 16:50:34 2013 +0300
+++ b/src/lib-http/http-client-host.c Wed Apr 10 17:53:24 2013 +0300
@@ -379,6 +379,7 @@
{
struct http_client_host *host = *_host;
struct http_client_host_port *hport;
+ struct http_client_request *req, *const *reqp;
const char *hostname = host->name;
http_client_host_debug(host, "Host destroy");
@@ -395,7 +396,13 @@
}
array_free(&host->ports);
- i_assert(array_count(&host->delayed_failing_requests) == 0);
+ while (array_count(&host->delayed_failing_requests) > 0) {
+ reqp = array_idx(&host->delayed_failing_requests, 0);
+ req = *reqp;
+
+ i_assert(req->refcount == 1);
+ http_client_request_unref(&req);
+ }
array_free(&host->delayed_failing_requests);
i_free(host->ips);
diff -r 286fa7f9538c -r 6466af800ed4 src/lib-http/http-client-request.c
--- a/src/lib-http/http-client-request.c Wed Apr 10 16:50:34 2013 +0300
+++ b/src/lib-http/http-client-request.c Wed Apr 10 17:53:24 2013 +0300
@@ -49,6 +49,7 @@
/*
* Request
*/
+static void http_client_request_remove_delayed(struct http_client_request *req);
#undef http_client_request
struct http_client_request *
@@ -81,23 +82,6 @@
req->refcount++;
}
-static void http_client_request_remove_delayed(struct http_client_request *req)
-{
- struct http_client_request *const *reqs;
- unsigned int i, count;
-
- timeout_remove(&req->to_delayed_error);
-
- reqs = array_get(&req->host->delayed_failing_requests, &count);
- for (i = 0; i < count; i++) {
- if (reqs[i] == req) {
- array_delete(&req->host->delayed_failing_requests, i, 1);
- return;
- }
- }
- i_unreached();
-}
-
void http_client_request_unref(struct http_client_request **_req)
{
struct http_client_request *req = *_req;
@@ -487,11 +471,29 @@
}
}
+static void http_client_request_remove_delayed(struct http_client_request *req)
+{
+ struct http_client_request *const *reqs;
+ unsigned int i, count;
+
+ http_client_request_send_error(req, req->delayed_error_status,
+ req->delayed_error);
+
+ timeout_remove(&req->to_delayed_error);
+
+ reqs = array_get(&req->host->delayed_failing_requests, &count);
+ for (i = 0; i < count; i++) {
+ if (reqs[i] == req) {
+ array_delete(&req->host->delayed_failing_requests, i, 1);
+ return;
+ }
+ }
+ i_unreached();
+}
+
static void http_client_request_error_delayed(struct http_client_request *req)
{
http_client_request_remove_delayed(req);
- http_client_request_send_error(req, req->delayed_error_status,
- req->delayed_error);
http_client_request_unref(&req);
}
More information about the dovecot-cvs
mailing list