Introduce a function sshfwd_unclean_close(), supplied by ssh.c to
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 8 Dec 2011 19:15:58 +0000 (19:15 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 8 Dec 2011 19:15:58 +0000 (19:15 +0000)
commitc6b4179107355f38804d343201876bde9181c990
treeeb5ef08cdbef0c00a670e360dd291f8593f4834a
parent43a1c4a467dcf78e1bf7f8aa71d2f685a79d757d
Introduce a function sshfwd_unclean_close(), supplied by ssh.c to
subsidiary network modules like portfwd.c. To be called when the
subsidiary module experiences a socket error: it sends an emergency
CHANNEL_CLOSE (not just outgoing CHANNEL_EOF), and immediately deletes
the local side of the channel. (I've invented a new channel type in
ssh.c called CHAN_ZOMBIE, for channels whose original local side has
already been thrown away and they're just hanging around waiting to
receive the acknowledging CHANNEL_CLOSE.)

As a result of this and the last few commits, I can now run a port
forwarding session in which a local socket error occurs on a forwarded
port, and PuTTY now handles it apparently correctly, closing both the
SSH channel and the local socket and then actually recognising that
it's OK to terminate when all _other_ channels have been closed.
Previously the channel corresponding to the duff connection would
linger around (because of net_pending_errors never being called), and
keep being selected on (hence chewing CPU), and inhibit program
termination at the end of the session (because not all channels were
closed).

git-svn-id: svn://svn.tartarus.org/sgt/putty@9364 cda61777-01e9-0310-a592-d414129be87e
portfwd.c
ssh.c
ssh.h