X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=x11fwd.c;h=5b4f76cdcb0e95c0899b9e088dc4eff1dcd2c668;hb=c10a8dee07fc10cbe9295e1a088b15b6e357f774;hp=ba5bbf98746d7732bfa31276598788a411e53523;hpb=947962e0b95e10151c186048a8b5cc2fb425838c;p=PuTTY.git diff --git a/x11fwd.c b/x11fwd.c index ba5bbf98..5b4f76cd 100644 --- a/x11fwd.c +++ b/x11fwd.c @@ -503,16 +503,20 @@ static int x11_closing(Plug plug, const char *error_msg, int error_code, { struct X11Private *pr = (struct X11Private *) 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. - */ - 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; }