1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-06 05:52: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:
Simon Tatham
2021-10-23 17:54:21 +01:00
parent b13f3d079b
commit d42f1fe96d
26 changed files with 76 additions and 101 deletions

View File

@ -87,7 +87,7 @@ struct PlugVtable {
* the logged events.
*/
void (*closing)
(Plug *p, const char *error_msg, int error_code, bool calling_back);
(Plug *p, const char *error_msg, int error_code);
/* error_msg is NULL iff it is not an error (ie it closed normally) */
/* calling_back != 0 iff there is a Plug function */
/* currently running (would cure the fixme in try_send()) */
@ -214,9 +214,8 @@ static inline void sk_write_eof(Socket *s)
static inline void plug_log(
Plug *p, int type, SockAddr *addr, int port, const char *msg, int code)
{ p->vt->log(p, type, addr, port, msg, code); }
static inline void plug_closing(
Plug *p, const char *msg, int code, bool calling_back)
{ p->vt->closing(p, msg, code, calling_back); }
static inline void plug_closing(Plug *p, const char *msg, int code)
{ p->vt->closing(p, msg, code); }
static inline void plug_receive(Plug *p, int urg, const char *data, size_t len)
{ p->vt->receive(p, urg, data, len); }
static inline void plug_sent (Plug *p, size_t bufsize)
@ -341,8 +340,7 @@ extern Plug *const nullplug;
*/
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,
bool calling_back);
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);