X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=portfwd.c;h=39ff59721b593c8888744796065a61409dc17f19;hb=3e22c99c9a3c28e042f2dc3a50fadf95e7c277e7;hp=e7e9d638590d0c73630a514ee182c61cbbde4bdf;hpb=a1f3b7a358adaa7c2a98359cd0373aa823eeb14b;p=PuTTY.git diff --git a/portfwd.c b/portfwd.c index e7e9d638..39ff5972 100644 --- a/portfwd.c +++ b/portfwd.c @@ -61,14 +61,20 @@ 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. - */ - if (pr->c) - sshfwd_close(pr->c); - pfd_close(pr->s); + 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; } @@ -537,6 +543,10 @@ int pfd_send(Socket s, char *data, int len) return sk_write(s, data, len); } +void pfd_send_eof(Socket s) +{ + sk_write_eof(s); +} void pfd_confirm(Socket s) {