dovecot-2.2: login proxy: Small code cleanup
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 3 22:48:22 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/6b901abc1819
changeset: 19085:6b901abc1819
user: Timo Sirainen <tss at iki.fi>
date: Fri Sep 04 01:10:29 2015 +0300
description:
login proxy: Small code cleanup
diffstat:
src/login-common/login-proxy.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diffs (73 lines):
diff -r 5c8be83ada6c -r 6b901abc1819 src/login-common/login-proxy.c
--- a/src/login-common/login-proxy.c Thu Sep 03 22:12:14 2015 +0300
+++ b/src/login-common/login-proxy.c Fri Sep 04 01:10:29 2015 +0300
@@ -69,9 +69,9 @@
ATTR_NULL(2);
static void login_proxy_free_errno(struct login_proxy **proxy,
- int err, const char *who)
+ int err, bool server)
{
- const char *reason;
+ const char *reason, *who = server ? "server" : "client";
reason = err == 0 || err == EPIPE ?
t_strdup_printf("Disconnected by %s", who) :
@@ -95,7 +95,7 @@
ret = net_receive(proxy->server_fd, buf, sizeof(buf));
if (ret < 0) {
- login_proxy_free_errno(&proxy, errno, "server");
+ login_proxy_free_errno(&proxy, errno, TRUE);
return;
}
o_stream_cork(proxy->client_output);
@@ -103,8 +103,7 @@
o_stream_uncork(proxy->client_output);
if (ret2 != ret) {
login_proxy_free_errno(&proxy,
- proxy->client_output->stream_errno,
- "client");
+ proxy->client_output->stream_errno, FALSE);
}
}
@@ -124,7 +123,7 @@
ret = net_receive(proxy->client_fd, buf, sizeof(buf));
if (ret < 0) {
- login_proxy_free_errno(&proxy, errno, "client");
+ login_proxy_free_errno(&proxy, errno, FALSE);
return;
}
o_stream_cork(proxy->server_output);
@@ -132,8 +131,7 @@
o_stream_uncork(proxy->server_output);
if (ret2 != ret) {
login_proxy_free_errno(&proxy,
- proxy->server_output->stream_errno,
- "server");
+ proxy->server_output->stream_errno, TRUE);
}
}
@@ -142,8 +140,7 @@
proxy->last_io = ioloop_time;
if (o_stream_flush(proxy->server_output) < 0) {
login_proxy_free_errno(&proxy,
- proxy->server_output->stream_errno,
- "server");
+ proxy->server_output->stream_errno, TRUE);
return 1;
}
@@ -163,8 +160,7 @@
proxy->last_io = ioloop_time;
if (o_stream_flush(proxy->client_output) < 0) {
login_proxy_free_errno(&proxy,
- proxy->client_output->stream_errno,
- "client");
+ proxy->client_output->stream_errno, FALSE);
return 1;
}
More information about the dovecot-cvs
mailing list