From 3ad0a46f43bbd18f00a10bd74fa00b095b0a8da6 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Sun, 4 Dec 2016 16:00:49 +0100 Subject: [PATCH] lib-http: client: Simplified initiation of connection setup upon request submission. --- src/lib-http/http-client-host.c | 13 ------------- src/lib-http/http-client-queue.c | 7 ++++--- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/lib-http/http-client-host.c b/src/lib-http/http-client-host.c index 2d1f3f2f23..1350f5c8ff 100644 --- a/src/lib-http/http-client-host.c +++ b/src/lib-http/http-client-host.c @@ -256,19 +256,6 @@ void http_client_host_submit_request(struct http_client_host *host, /* cancel host idle timeout */ timeout_remove(&host->to_idle); - - if (host->unix_local) { - http_client_queue_connection_setup(queue); - return; - } - - /* start DNS lookup if necessary */ - if (host->ips_count == 0 && host->dns_lookup == NULL) - http_client_host_lookup(host); - - /* make a connection if we have an IP already */ - if (host->ips_count > 0) - http_client_queue_connection_setup(queue); } void http_client_host_free(struct http_client_host **_host) diff --git a/src/lib-http/http-client-queue.c b/src/lib-http/http-client-queue.c index 2c62c1816f..743a710b90 100644 --- a/src/lib-http/http-client-queue.c +++ b/src/lib-http/http-client-queue.c @@ -838,7 +838,8 @@ static void http_client_queue_submit_now(struct http_client_queue *queue, } else if (timeval_diff_msecs(&req->timeout_time, &ioloop_timeval) <= 1) { /* pretty much already timed out; don't bother */ - + return; + } else { unsigned int insert_idx; @@ -847,6 +848,8 @@ static void http_client_queue_submit_now(struct http_client_queue *queue, &req, http_client_queue_request_timeout_cmp, &insert_idx); array_insert(req_queue, insert_idx, &req, 1); } + + http_client_queue_connection_setup(queue); } /* @@ -881,8 +884,6 @@ http_client_queue_delay_timeout(struct http_client_queue *queue) http_client_queue_set_delay_timer(queue, reqs[i]->release_time); } array_delete(&queue->delayed_requests, 0, finished); - - http_client_queue_connection_setup(queue); } static void