dovecot-2.2-pigeonhole: managesieve: Started using io_stream_get...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Mon Sep 7 23:08:40 UTC 2015


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/633bf3c89a39
changeset: 2095:633bf3c89a39
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Sep 08 01:07:43 2015 +0200
description:
managesieve: Started using io_stream_get_disconnect_reason() for default client_destroy() reason.

diffstat:

 src/managesieve/managesieve-client.c |  20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)

diffs (44 lines):

diff -r 45854bc3a431 -r 633bf3c89a39 src/managesieve/managesieve-client.c
--- a/src/managesieve/managesieve-client.c	Sat Aug 29 13:12:58 2015 +0200
+++ b/src/managesieve/managesieve-client.c	Tue Sep 08 01:07:43 2015 +0200
@@ -9,6 +9,7 @@
 #include "net.h"
 #include "istream.h"
 #include "ostream.h"
+#include "iostream.h"
 #include "var-expand.h"
 #include "master-service.h"
 #include "mail-storage-service.h"
@@ -211,19 +212,6 @@
 	return str_c(str);
 }
 
-static const char *client_get_disconnect_reason(struct client *client)
-{
-	errno = client->input->stream_errno != 0 ?
-		client->input->stream_errno :
-		client->output->stream_errno;
-	if (errno == 0 || errno == EPIPE)
-		return "Connection closed";
-	return t_strdup_printf("Connection closed: %s",
-			       client->input->stream_errno != 0 ?
-			       i_stream_get_error(client->input) :
-			       o_stream_get_error(client->output));
-}
-
 void client_destroy(struct client *client, const char *reason)
 {
 	int ret;
@@ -234,8 +222,10 @@
 
 	if (!client->disconnected) {
 		client->disconnected = TRUE;
-		if (reason == NULL)
-			reason = client_get_disconnect_reason(client);
+		if (reason == NULL) {
+			reason = io_stream_get_disconnect_reason(client->input,
+								 client->output);
+		}
 		i_info("%s %s", reason, client_stats(client));
 	}
 


More information about the dovecot-cvs mailing list