1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 20:42:48 -05:00

Factor out the back ends' plug log functions.

I'm about to want to make a change to all those functions at once, and
since they're almost identical, it seemed easiest to pull them out
into a common helper. The new source file be_misc.c is intended to
contain helper code common to all network back ends (crypto and
non-crypto, in particular), and initially it contains a
backend_socket_log() function which is the common part of ssh_log(),
telnet_log(), rlogin_log() etc.
This commit is contained in:
Simon Tatham
2015-11-22 11:49:14 +00:00
parent bb66e9870e
commit a6e76ae453
7 changed files with 66 additions and 60 deletions

13
raw.c
View File

@ -40,17 +40,8 @@ static void raw_log(Plug plug, int type, SockAddr addr, int port,
const char *error_msg, int error_code)
{
Raw raw = (Raw) plug;
char addrbuf[256], *msg;
sk_getaddr(addr, addrbuf, lenof(addrbuf));
if (type == 0)
msg = dupprintf("Connecting to %s port %d", addrbuf, port);
else
msg = dupprintf("Failed to connect to %s: %s", addrbuf, error_msg);
logevent(raw->frontend, msg);
sfree(msg);
backend_socket_log(raw->frontend, type, addr, port,
error_msg, error_code);
}
static void raw_check_close(Raw raw)