1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Log when a network connection succeeds.

Now I've got an enum for PlugLogType, it's easier to add things to it.
We were giving a blow-by-blow account of each connection attempt, and
when it failed, saying what went wrong before we moved on to the next
candidate address, but when one finally succeeded, we never logged
_that_. Now we do.
This commit is contained in:
Simon Tatham
2020-02-07 19:18:50 +00:00
parent 91bb475087
commit 630cac3aa2
5 changed files with 33 additions and 5 deletions

View File

@ -1068,6 +1068,9 @@ static DWORD try_connect(NetSocket *sock)
* and we should set the socket as writable.
*/
sock->writable = true;
SockAddr thisaddr = sk_extractaddr_tmp(sock->addr, &sock->step);
plug_log(sock->plug, PLUGLOG_CONNECT_SUCCESS,
&thisaddr, sock->port, NULL, 0);
}
err = 0;
@ -1546,12 +1549,18 @@ void select_result(WPARAM wParam, LPARAM lParam)
case FD_CONNECT:
s->connected = true;
s->writable = true;
/*
* Once a socket is connected, we can stop falling
* back through the candidate addresses to connect
* to.
* Once a socket is connected, we can stop falling back
* through the candidate addresses to connect to. But first,
* let the plug know we were successful.
*/
if (s->addr) {
SockAddr thisaddr = sk_extractaddr_tmp(
s->addr, &s->step);
plug_log(s->plug, PLUGLOG_CONNECT_SUCCESS,
&thisaddr, s->port, NULL, 0);
sk_addr_free(s->addr);
s->addr = NULL;
}