1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

sshshare: notify cl when last downstream goes away.

The check_termination function in ssh2connection is supposed to be
called whenever it's possible that we've run out of (a) channels, and
(b) sharing downstreams. I've been calling it on every channel close,
but apparently completely forgot to add a callback from sshshare.c
that also arranges to call it when we run out of downstreams.
This commit is contained in:
Simon Tatham
2018-09-28 20:52:36 +01:00
parent 5a6608bda8
commit 57553bdaac
4 changed files with 26 additions and 1 deletions

View File

@ -905,12 +905,22 @@ static void share_try_cleanup(struct ssh_sharing_connstate *cs)
if (count234(cs->halfchannels) == 0 &&
count234(cs->channels_by_us) == 0 &&
count234(cs->forwardings) == 0) {
struct ssh_sharing_state *sharestate = cs->parent;
/*
* Now we're _really_ done, so we can get rid of cs completely.
*/
del234(cs->parent->connections, cs);
del234(sharestate->connections, cs);
log_downstream(cs, "disconnected");
share_connstate_free(cs);
/*
* And if this was the last downstream, notify the connection
* layer, because it might now be time to wind up the whole
* SSH connection.
*/
if (count234(sharestate->connections) == 0 && sharestate->cl)
ssh_sharing_no_more_downstreams(sharestate->cl);
}
}