]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Notify host object about submission of request before submitting...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 6 Jul 2018 13:07:32 +0000 (15:07 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 6 Feb 2019 08:08:38 +0000 (10:08 +0200)
This makes sure the host idle timeout is stopped before the request is submitted
and the host object's refresh function is called. If the idle timeout is still
running at that point, the refresh function will return success without
performing a lookup, which can lead to a panic.

Panic was:

Panic: file ./http-client-private.h: line 672 (http_client_host_get_ip): assertion failed: (idx < host->shared->ips_count)

src/lib-http/http-client-host.c

index 1d2d5ac81a8bdca17c917906a5f537c116990933..3fc7cd51cbfa6b5f5332e6c235a2ce3cb8894268 100644 (file)
@@ -426,12 +426,12 @@ void http_client_host_submit_request(struct http_client_host *host,
                }
        }
 
+       http_client_host_shared_request_submitted(host->shared);
+
        /* add request to queue */
        queue = http_client_queue_get(host, &addr);
        http_client_queue_submit_request(queue, req);
 
-       http_client_host_shared_request_submitted(host->shared);
-
        /* queue will trigger host lookup once the request is activated
           (may be delayed) */
 }