1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Backends: notify ldisc when sendok becomes true. (NFC)

I've introduced a function ldisc_notify_sendok(), which backends
should call on their ldisc (if they have one) when anything changes
that might cause backend_sendok() to start returning true.

At the moment, the function does nothing. But in future, I'm going to
make ldisc start buffering typed-ahead input data not yet sent to the
backend, and then the effect of this function will be to trigger
flushing all that data into the backend.

Backends only have to call this function if sendok was previously
false: backends requiring no network connection stage (like pty and
serial) can safely return true from sendok, and in that case, they
don't also have to immediately call this function.
This commit is contained in:
Simon Tatham
2021-09-14 10:13:28 +01:00
parent 2fd2f4715d
commit 9f0e7d2915
13 changed files with 39 additions and 2 deletions

View File

@ -775,6 +775,8 @@ static void ssh1_set_wants_user_input(ConnectionLayer *cl, bool wanted)
s->want_user_input = wanted;
s->finished_setup = true;
if (wanted)
ssh_check_sendok(s->ppl.ssh);
}
static bool ssh1_connection_want_user_input(PacketProtocolLayer *ppl)

View File

@ -1709,6 +1709,8 @@ static void ssh2_set_wants_user_input(ConnectionLayer *cl, bool wanted)
container_of(cl, struct ssh2_connection_state, cl);
s->want_user_input = wanted;
if (wanted)
ssh_check_sendok(s->ppl.ssh);
}
static bool ssh2_connection_want_user_input(PacketProtocolLayer *ppl)

View File

@ -244,6 +244,8 @@ Conf *make_ssh_server_conf(void)
return conf;
}
void ssh_check_sendok(Ssh *ssh) {}
static const PlugVtable ssh_server_plugvt = {
.log = server_socket_log,
.closing = server_closing,

View File

@ -1156,6 +1156,14 @@ static bool ssh_sendok(Backend *be)
return ssh->base_layer && ssh_ppl_want_user_input(ssh->base_layer);
}
void ssh_check_sendok(Ssh *ssh)
{
/* Called when the connection layer might have caused ssh_sendok
* to start returning true */
if (ssh->ldisc)
ldisc_check_sendok(ssh->ldisc);
}
void ssh_ldisc_update(Ssh *ssh)
{
/* Called when the connection layer wants to propagate an update