dovecot-2.2: lib: Cork connection output while handling input

dovecot at dovecot.org dovecot at dovecot.org
Thu May 21 12:41:06 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/191eaf662c21
changeset: 18734:191eaf662c21
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 21 08:38:56 2015 -0400
description:
lib: Cork connection output while handling input

diffstat:

 src/lib/connection.c |  10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r 5b902db0cabc -r 191eaf662c21 src/lib/connection.c
--- a/src/lib/connection.c	Thu May 21 06:35:59 2015 -0400
+++ b/src/lib/connection.c	Thu May 21 08:38:56 2015 -0400
@@ -27,6 +27,7 @@
 {
 	const char *line;
 	struct istream *input;
+	struct ostream *output;
 	int ret = 0;
 
 	switch (connection_input_read(conn)) {
@@ -40,7 +41,12 @@
 	}
 
 	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 @@
 		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);


More information about the dovecot-cvs mailing list