From: simon Date: Thu, 26 Jan 2012 18:22:28 +0000 (+0000) Subject: If we're called on to uncleanly close an SSH channel for which we've X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/962103934b0309c733f32cc6b4600a1bac8eb70f?hp=3bd9f270ec6af9b2e2897bf7d3cc3e91c8cf14dd If we're called on to uncleanly close an SSH channel for which we've already sent SSH2_MSG_CHANNEL_CLOSE, we should not skip the _whole_ of sshfwd_unclean_close(), only the part about sending SSH2_MSG_CHANNEL_CLOSE. It's still important to retag the SSH channel as CHAN_ZOMBIE and clean up its previous data provider. git-svn-id: svn://svn.tartarus.org/sgt/putty@9389 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/ssh.c b/ssh.c index b4c634d3..505b4ae1 100644 --- a/ssh.c +++ b/ssh.c @@ -4266,13 +4266,13 @@ void sshfwd_unclean_close(struct ssh_channel *c) if (ssh->state == SSH_STATE_CLOSED) return; - if (c->closes & CLOSES_SENT_CLOSE) - return; + if (!(c->closes & CLOSES_SENT_CLOSE)) { + pktout = ssh2_pkt_init(SSH2_MSG_CHANNEL_CLOSE); + ssh2_pkt_adduint32(pktout, c->remoteid); + ssh2_pkt_send(ssh, pktout); + c->closes |= CLOSES_SENT_EOF | CLOSES_SENT_CLOSE; + } - pktout = ssh2_pkt_init(SSH2_MSG_CHANNEL_CLOSE); - ssh2_pkt_adduint32(pktout, c->remoteid); - ssh2_pkt_send(ssh, pktout); - c->closes |= CLOSES_SENT_EOF | CLOSES_SENT_CLOSE; switch (c->type) { case CHAN_X11: x11_close(c->u.x11.s); @@ -4283,6 +4283,7 @@ void sshfwd_unclean_close(struct ssh_channel *c) break; } c->type = CHAN_ZOMBIE; + ssh2_channel_check_close(c); }