mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
d42f1fe96d
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.
41 lines
1020 B
C
41 lines
1020 B
C
/*
|
|
* nullplug.c: provide a null implementation of the Plug vtable which
|
|
* ignores all calls. Occasionally useful in cases where we want to
|
|
* make a network connection just to see if it works, but not do
|
|
* anything with it afterwards except close it again.
|
|
*/
|
|
|
|
#include "putty.h"
|
|
|
|
void nullplug_log(Plug *plug, PlugLogType type, SockAddr *addr,
|
|
int port, const char *err_msg, int err_code)
|
|
{
|
|
}
|
|
|
|
void nullplug_closing(Plug *plug, const char *error_msg, int error_code)
|
|
{
|
|
}
|
|
|
|
void nullplug_receive(Plug *plug, int urgent, const char *data, size_t len)
|
|
{
|
|
}
|
|
|
|
void nullplug_sent(Plug *plug, size_t bufsize)
|
|
{
|
|
}
|
|
|
|
static const PlugVtable nullplug_plugvt = {
|
|
.log = nullplug_log,
|
|
.closing = nullplug_closing,
|
|
.receive = nullplug_receive,
|
|
.sent = nullplug_sent,
|
|
};
|
|
|
|
static Plug nullplug_plug = { &nullplug_plugvt };
|
|
|
|
/*
|
|
* There's a singleton instance of nullplug, because it's not
|
|
* interesting enough to worry about making more than one of them.
|
|
*/
|
|
Plug *const nullplug = &nullplug_plug;
|