]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login-proxy: cork+uncork in flush callbacks
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Jun 2016 23:49:32 +0000 (02:49 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Jun 2016 23:52:47 +0000 (02:52 +0300)
Potentially reduces latency at the end of a larger data transfer.

src/login-common/login-proxy.c

index fb35e8900926d6fccae1ca7f36dc80b407d395cb..819cb8f2420d204b8659a68b448df89d7bfb0931 100644 (file)
@@ -197,10 +197,12 @@ static void proxy_client_disconnected_input(struct login_proxy *proxy)
 static int server_output(struct login_proxy *proxy)
 {
        proxy->last_io = ioloop_time;
+       o_stream_cork(proxy->server_output);
        if (o_stream_flush(proxy->server_output) < 0) {
                login_proxy_free_ostream(&proxy, proxy->server_output, TRUE);
                return 1;
        }
+       o_stream_uncork(proxy->server_output);
 
        if (proxy->client_io == NULL &&
            o_stream_get_buffer_used_size(proxy->server_output) <
@@ -216,10 +218,12 @@ static int server_output(struct login_proxy *proxy)
 static int proxy_client_output(struct login_proxy *proxy)
 {
        proxy->last_io = ioloop_time;
+       o_stream_cork(proxy->client_output);
        if (o_stream_flush(proxy->client_output) < 0) {
                login_proxy_free_ostream(&proxy, proxy->client_output, FALSE);
                return 1;
        }
+       o_stream_uncork(proxy->client_output);
 
        if (proxy->server_io == NULL &&
            o_stream_get_buffer_used_size(proxy->client_output) <