dovecot-2.2: login proxy: Code cleanup - separate login_proxy_fr...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 3 22:48:33 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/574ba1f25346
changeset: 19088:574ba1f25346
user: Timo Sirainen <tss at iki.fi>
date: Fri Sep 04 01:23:28 2015 +0300
description:
login proxy: Code cleanup - separate login_proxy_free_final()
diffstat:
src/login-common/login-proxy.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r 1a4445b58279 -r 574ba1f25346 src/login-common/login-proxy.c
--- a/src/login-common/login-proxy.c Fri Sep 04 01:21:28 2015 +0300
+++ b/src/login-common/login-proxy.c Fri Sep 04 01:23:28 2015 +0300
@@ -419,6 +419,18 @@
net_disconnect(proxy->server_fd);
}
+static void login_proxy_free_final(struct login_proxy *proxy)
+{
+ if (proxy->client_output != NULL)
+ o_stream_destroy(&proxy->client_output);
+ if (proxy->client_fd != -1)
+ net_disconnect(proxy->client_fd);
+ if (proxy->ssl_server_proxy != NULL)
+ ssl_proxy_free(&proxy->ssl_server_proxy);
+ i_free(proxy->host);
+ i_free(proxy);
+}
+
static void ATTR_NULL(2)
login_proxy_free_reason(struct login_proxy **_proxy, const char *reason)
{
@@ -447,23 +459,17 @@
if (proxy->client_io != NULL)
io_remove(&proxy->client_io);
- if (proxy->client_output != NULL)
- o_stream_destroy(&proxy->client_output);
- net_disconnect(proxy->client_fd);
} else {
i_assert(proxy->client_io == NULL);
i_assert(proxy->client_output == NULL);
+ i_assert(proxy->client_fd == -1);
DLLIST_REMOVE(&login_proxies_pending, proxy);
if (proxy->callback != NULL)
proxy->callback(proxy->client);
}
-
- if (proxy->ssl_server_proxy != NULL)
- ssl_proxy_free(&proxy->ssl_server_proxy);
- i_free(proxy->host);
- i_free(proxy);
+ login_proxy_free_final(proxy);
client->login_proxy = NULL;
client_unref(&client);
More information about the dovecot-cvs
mailing list