mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Remove 'calling_back' parameter from plug_closing.
It was totally unused. No implementation of the 'closing' method in a
Plug vtable was checking it for any reason at all, except for
ProxySocket which captured it from its client in order to pass on to
its server (which, perhaps after further iterations of ProxySocket,
would have ended up ignoring it similarly). And every caller of
plug_closing set it to 0 (aka false), except for the one in sshproxy.c
which passed true (but it would have made no difference to anyone).
The comment in network.h refers to a FIXME comment which was in
try_send() when that code was written (see winnet.c in commit
7b0e082700
). That FIXME is long gone, replaced by a use of a
toplevel callback. So I think the aim must have been to avoid
re-entrancy when sk_write called try_send which encountered a socket
error and called back to plug_closing - but that's long since fixed by
other means now.
This commit is contained in:
@ -158,8 +158,7 @@ static void fdsocket_error_callback(void *vs)
|
||||
/*
|
||||
* An error has occurred on this socket. Pass it to the plug.
|
||||
*/
|
||||
plug_closing(fds->plug, strerror(fds->pending_error),
|
||||
fds->pending_error, 0);
|
||||
plug_closing(fds->plug, strerror(fds->pending_error), fds->pending_error);
|
||||
}
|
||||
|
||||
static int fdsocket_try_send(FdSocket *fds)
|
||||
@ -271,9 +270,9 @@ static void fdsocket_select_result_input(int fd, int event)
|
||||
fds->infd = -1;
|
||||
|
||||
if (retd < 0) {
|
||||
plug_closing(fds->plug, strerror(errno), errno, 0);
|
||||
plug_closing(fds->plug, strerror(errno), errno);
|
||||
} else {
|
||||
plug_closing(fds->plug, NULL, 0, 0);
|
||||
plug_closing(fds->plug, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1101,7 +1101,7 @@ static void socket_error_callback(void *vs)
|
||||
/*
|
||||
* An error has occurred on this socket. Pass it to the plug.
|
||||
*/
|
||||
plug_closing(s->plug, strerror(s->pending_error), s->pending_error, 0);
|
||||
plug_closing(s->plug, strerror(s->pending_error), s->pending_error);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1298,7 +1298,7 @@ static void net_select_result(int fd, int event)
|
||||
if (ret <= 0) {
|
||||
plug_closing(s->plug,
|
||||
ret == 0 ? "Internal networking trouble" :
|
||||
strerror(errno), errno, 0);
|
||||
strerror(errno), errno);
|
||||
} else {
|
||||
/*
|
||||
* Receiving actual data on a socket means we can
|
||||
@ -1384,11 +1384,11 @@ static void net_select_result(int fd, int event)
|
||||
}
|
||||
}
|
||||
if (ret < 0) {
|
||||
plug_closing(s->plug, strerror(errno), errno, 0);
|
||||
plug_closing(s->plug, strerror(errno), errno);
|
||||
} else if (0 == ret) {
|
||||
s->incomingeof = true; /* stop trying to read now */
|
||||
uxsel_tell(s);
|
||||
plug_closing(s->plug, NULL, 0, 0);
|
||||
plug_closing(s->plug, NULL, 0);
|
||||
} else {
|
||||
/*
|
||||
* Receiving actual data on a socket means we can
|
||||
@ -1438,7 +1438,7 @@ static void net_select_result(int fd, int event)
|
||||
err = try_connect(s);
|
||||
}
|
||||
if (err) {
|
||||
plug_closing(s->plug, strerror(err), err, 0);
|
||||
plug_closing(s->plug, strerror(err), err);
|
||||
return; /* socket is now presumably defunct */
|
||||
}
|
||||
if (!s->connected)
|
||||
|
@ -249,8 +249,7 @@ 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) {}
|
||||
static void x11_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
bool calling_back)
|
||||
static void x11_closing(Plug *plug, const char *error_msg, int error_code)
|
||||
{
|
||||
time_to_die = true;
|
||||
}
|
||||
|
@ -273,8 +273,7 @@ static void server_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
|
||||
log_to_stderr(-1, error_msg);
|
||||
}
|
||||
|
||||
static void server_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
bool calling_back)
|
||||
static void server_closing(Plug *plug, const char *error_msg, int error_code)
|
||||
{
|
||||
log_to_stderr(-1, error_msg);
|
||||
}
|
||||
|
@ -482,8 +482,7 @@ static void server_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
|
||||
log_to_stderr((unsigned)-1, error_msg);
|
||||
}
|
||||
|
||||
static void server_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
bool calling_back)
|
||||
static void server_closing(Plug *plug, const char *error_msg, int error_code)
|
||||
{
|
||||
log_to_stderr((unsigned)-1, error_msg);
|
||||
}
|
||||
|
Reference in New Issue
Block a user