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

Make the plug_log type code into an enum.

Those magic numbers have been annoying for ages. Now they have names
that I havea fighting chance of remembering the meanings of.
This commit is contained in:
Simon Tatham
2020-02-07 19:17:45 +00:00
parent 06531c3b61
commit 91bb475087
17 changed files with 59 additions and 46 deletions

View File

@ -575,7 +575,8 @@ static int try_connect(NetSocket *sock)
{
SockAddr thisaddr = sk_extractaddr_tmp(
sock->addr, &sock->step);
plug_log(sock->plug, 0, &thisaddr, sock->port, NULL, 0);
plug_log(sock->plug, PLUGLOG_CONNECT_TRYING,
&thisaddr, sock->port, NULL, 0);
}
/*
@ -746,7 +747,8 @@ static int try_connect(NetSocket *sock)
if (err) {
SockAddr thisaddr = sk_extractaddr_tmp(
sock->addr, &sock->step);
plug_log(sock->plug, 1, &thisaddr, sock->port, strerror(err), err);
plug_log(sock->plug, PLUGLOG_CONNECT_FAILED,
&thisaddr, sock->port, strerror(err), err);
}
return err;
}
@ -1421,7 +1423,8 @@ static void net_select_result(int fd, int event)
assert(s->addr);
thisaddr = sk_extractaddr_tmp(s->addr, &s->step);
plug_log(s->plug, 1, &thisaddr, s->port, errmsg, err);
plug_log(s->plug, PLUGLOG_CONNECT_FAILED,
&thisaddr, s->port, errmsg, err);
while (err && s->addr && sk_nextaddr(s->addr, &s->step)) {
err = try_connect(s);

View File

@ -199,7 +199,7 @@ void chan_no_request_response(Channel *chan, bool success) {}
* except that x11_closing has to signal back to the main loop that
* it's time to terminate.
*/
static void x11_log(Plug *p, int type, SockAddr *addr, int port,
static void x11_log(Plug *p, PlugLogType type, SockAddr *addr, int port,
const char *error_msg, int error_code) {}
static void x11_receive(Plug *plug, int urgent, const char *data, size_t len) {}
static void x11_sent(Plug *plug, size_t bufsize) {}

View File

@ -33,7 +33,7 @@ Socket *platform_new_connection(SockAddr *addr, const char *hostname,
{
char *logmsg = dupprintf("Starting local proxy command: %s", cmd);
plug_log(plug, 2, NULL, 0, logmsg, 0);
plug_log(plug, PLUGLOG_PROXY_MSG, NULL, 0, logmsg, 0);
sfree(logmsg);
}

View File

@ -447,7 +447,7 @@ static Plug *server_conn_plug(
&inst->ap, &inst->logpolicy, &unix_live_sftpserver_vt);
}
static void server_log(Plug *plug, int type, SockAddr *addr, int port,
static void server_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
const char *error_msg, int error_code)
{
log_to_stderr((unsigned)-1, error_msg);