X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=portfwd.c;h=39ff59721b593c8888744796065a61409dc17f19;hb=5ebf74d103034960dd8f1c4ad0cc15254317dce0;hp=cd66a9847335f46b0752640df1006c4b4344f60c;hpb=947962e0b95e10151c186048a8b5cc2fb425838c;p=PuTTY.git diff --git a/portfwd.c b/portfwd.c index cd66a984..39ff5972 100644 --- a/portfwd.c +++ b/portfwd.c @@ -61,17 +61,19 @@ static int pfd_closing(Plug plug, const char *error_msg, int error_code, { struct PFwdPrivate *pr = (struct PFwdPrivate *) plug; - /* - * We have no way to communicate down the forwarded connection, - * so if an error occurred on the socket, we just ignore it - * and treat it like a proper close. - * - * FIXME: except we could initiate a full close here instead of - * just an outgoing EOF? ssh.c currently has no API for that, but - * it could. - */ - if (pr->c) - sshfwd_write_eof(pr->c); + if (error_msg) { + /* + * Socket error. Slam the connection instantly shut. + */ + sshfwd_unclean_close(pr->c); + } else { + /* + * Ordinary EOF received on socket. Send an EOF on the SSH + * channel. + */ + if (pr->c) + sshfwd_write_eof(pr->c); + } return 1; }