]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Cork connection output while handling input
authorTimo Sirainen <tss@iki.fi>
Thu, 21 May 2015 12:38:56 +0000 (08:38 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 21 May 2015 12:38:56 +0000 (08:38 -0400)
src/lib/connection.c

index 5f872bc7dfedcde885e2a82c73187b715a750f17..202ecf734e73754f7859d047b3df9a7c4650c18c 100644 (file)
@@ -27,6 +27,7 @@ void connection_input_default(struct connection *conn)
 {
        const char *line;
        struct istream *input;
+       struct ostream *output;
        int ret = 0;
 
        switch (connection_input_read(conn)) {
@@ -40,7 +41,12 @@ void connection_input_default(struct connection *conn)
        }
 
        input = conn->input;
+       output = conn->output;
        i_stream_ref(input);
+       if (output != NULL) {
+               o_stream_ref(output);
+               o_stream_cork(output);
+       }
        while (!input->closed && (line = i_stream_next_line(input)) != NULL) {
                T_BEGIN {
                        ret = conn->list->v.input_line(conn, line);
@@ -48,6 +54,10 @@ void connection_input_default(struct connection *conn)
                if (ret <= 0)
                        break;
        }
+       if (output != NULL) {
+               o_stream_uncork(output);
+               o_stream_unref(&output);
+       }
        if (ret < 0 && !input->closed) {
                conn->disconnect_reason = CONNECTION_DISCONNECT_DEINIT;
                conn->list->v.destroy(conn);