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:
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user