Skip to content

Commit

Permalink
lib-smtp: client: Amend connection debug message with source ip:port.
Browse files Browse the repository at this point in the history
Helps matching debug logs between client and server.
  • Loading branch information
stephanbosch committed May 25, 2018
1 parent f638d00 commit cf7416e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib-smtp/smtp-client-connection.c
Expand Up @@ -1308,7 +1308,17 @@ smtp_client_connection_connected(struct connection *_conn, bool success)
return;
}

smtp_client_connection_debug(conn, "Connected");
if (conn->set.debug) {
struct ip_addr local_ip;
in_port_t local_port;
int ret;

ret = net_getsockname(_conn->fd_in, &local_ip, &local_port);
i_assert(ret == 0);
smtp_client_connection_debug(conn,
"Connected to server (from %s:%u)",
net_ip2addr(&local_ip), local_port);
}

(void)net_set_tcp_nodelay(_conn->fd_out, TRUE);
if (set->socket_send_buffer_size > 0) {
Expand Down

0 comments on commit cf7416e

Please sign in to comment.