From: Stephan Bosch Date: Tue, 31 Oct 2017 01:27:47 +0000 (+0100) Subject: lmtp: proxy: Moved lmtp_proxy_data_cb(). X-Git-Tag: 2.3.0.rc1~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=122323b8d5f747b260cdc97c05d6598ca34d62cd;p=thirdparty%2Fdovecot%2Fcore.git lmtp: proxy: Moved lmtp_proxy_data_cb(). --- diff --git a/src/lmtp/lmtp-proxy.c b/src/lmtp/lmtp-proxy.c index 14e44b6de7..be49da6563 100644 --- a/src/lmtp/lmtp-proxy.c +++ b/src/lmtp/lmtp-proxy.c @@ -315,52 +315,6 @@ lmtp_proxy_rcpt_cb(const struct smtp_reply *proxy_reply, rcpt->rcpt_to_failed = !smtp_reply_is_success(proxy_reply); } -static void -lmtp_proxy_data_cb(const struct smtp_reply *proxy_reply, - struct lmtp_proxy_recipient *rcpt) -{ - struct lmtp_proxy_connection *conn = rcpt->conn; - const struct smtp_client_transaction_times *times = - smtp_client_transaction_get_times(conn->lmtp_trans); - string_t *reply; - string_t *msg; - - i_assert(!rcpt->rcpt_to_failed); - i_assert(rcpt->reply != NULL); - - /* reset timeout in case there are a lot of RCPT TOs */ - if (conn->to != NULL) - timeout_reset(conn->to); - - reply = t_str_new(128); - lmtp_proxy_write_reply(reply, proxy_reply); - - rcpt->reply = p_strdup(conn->proxy->pool, str_c(reply)); - rcpt->data_reply_received = TRUE; - - msg = t_str_new(128); - str_printfa(msg, "%s: ", conn->proxy->set.session_id); - if (smtp_reply_is_success(proxy_reply)) - str_append(msg, "Sent message to"); - else - str_append(msg, "Failed to send message to"); - str_printfa(msg, " <%s> at %s:%u: %s (%u/%u at %u ms)", - smtp_address_encode(rcpt->address), conn->set.host, - conn->set.port, str_c(reply), - rcpt->idx + 1, array_count(&conn->proxy->rcpt_to), - timeval_diff_msecs(&ioloop_timeval, ×->started)); - if (smtp_reply_is_success(proxy_reply) || - smtp_reply_is_remote(proxy_reply)) { - /* the problem isn't with the proxy, it's with the remote side. - so the remote side will log an error, while for us this is - just an info event */ - i_info("%s", str_c(msg)); - } else { - i_error("%s", str_c(msg)); - } - lmtp_proxy_try_finish(conn->proxy); -} - int lmtp_proxy_add_rcpt(struct lmtp_proxy *proxy, const struct smtp_address *address, const struct lmtp_proxy_rcpt_settings *set) @@ -588,6 +542,52 @@ bool client_proxy_rcpt(struct client *client, return TRUE; } +static void +lmtp_proxy_data_cb(const struct smtp_reply *proxy_reply, + struct lmtp_proxy_recipient *rcpt) +{ + struct lmtp_proxy_connection *conn = rcpt->conn; + const struct smtp_client_transaction_times *times = + smtp_client_transaction_get_times(conn->lmtp_trans); + string_t *reply; + string_t *msg; + + i_assert(!rcpt->rcpt_to_failed); + i_assert(rcpt->reply != NULL); + + /* reset timeout in case there are a lot of RCPT TOs */ + if (conn->to != NULL) + timeout_reset(conn->to); + + reply = t_str_new(128); + lmtp_proxy_write_reply(reply, proxy_reply); + + rcpt->reply = p_strdup(conn->proxy->pool, str_c(reply)); + rcpt->data_reply_received = TRUE; + + msg = t_str_new(128); + str_printfa(msg, "%s: ", conn->proxy->set.session_id); + if (smtp_reply_is_success(proxy_reply)) + str_append(msg, "Sent message to"); + else + str_append(msg, "Failed to send message to"); + str_printfa(msg, " <%s> at %s:%u: %s (%u/%u at %u ms)", + smtp_address_encode(rcpt->address), conn->set.host, + conn->set.port, str_c(reply), + rcpt->idx + 1, array_count(&conn->proxy->rcpt_to), + timeval_diff_msecs(&ioloop_timeval, ×->started)); + if (smtp_reply_is_success(proxy_reply) || + smtp_reply_is_remote(proxy_reply)) { + /* the problem isn't with the proxy, it's with the remote side. + so the remote side will log an error, while for us this is + just an info event */ + i_info("%s", str_c(msg)); + } else { + i_error("%s", str_c(msg)); + } + lmtp_proxy_try_finish(conn->proxy); +} + static void lmtp_proxy_data_dummy_cb(const struct smtp_reply *proxy_reply ATTR_UNUSED, struct lmtp_proxy_connection *conn ATTR_UNUSED)