1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 19:42: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

@ -17,6 +17,7 @@ struct Raw {
size_t bufsize;
Seat *seat;
LogContext *logctx;
Ldisc *ldisc;
bool sent_console_eof, sent_socket_eof, socket_connected;
Conf *conf;
@ -41,6 +42,8 @@ static void raw_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
error_code, raw->conf, raw->socket_connected);
if (type == PLUGLOG_CONNECT_SUCCESS) {
raw->socket_connected = true;
if (raw->ldisc)
ldisc_check_sendok(raw->ldisc);
if (is_tempseat(raw->seat)) {
Seat *ts = raw->seat;
tempseat_flush(ts);
@ -295,7 +298,8 @@ static bool raw_ldisc(Backend *be, int option)
static void raw_provide_ldisc(Backend *be, Ldisc *ldisc)
{
/* This is a stub. */
Raw *raw = container_of(be, Raw, backend);
raw->ldisc = ldisc;
}
static int raw_exitcode(Backend *be)

View File

@ -22,6 +22,7 @@ struct Rlogin {
int term_width, term_height;
Seat *seat;
LogContext *logctx;
Ldisc *ldisc;
Conf *conf;
@ -194,6 +195,8 @@ static void rlogin_startup(Rlogin *rlogin, int prompt_result,
}
rlogin->prompt = NULL;
if (rlogin->ldisc)
ldisc_check_sendok(rlogin->ldisc);
}
static const PlugVtable Rlogin_plugvt = {
@ -413,7 +416,8 @@ static bool rlogin_ldisc(Backend *be, int option)
static void rlogin_provide_ldisc(Backend *be, Ldisc *ldisc)
{
/* This is a stub. */
Rlogin *rlogin = container_of(be, Rlogin, backend);
rlogin->ldisc = ldisc;
}
static int rlogin_exitcode(Backend *be)

View File

@ -71,6 +71,7 @@ struct supdup_tag
Seat *seat;
LogContext *logctx;
Ldisc *ldisc;
int term_width, term_height;
long long ttyopt;
@ -565,6 +566,8 @@ static void supdup_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
supdup->conf, supdup->socket_connected);
if (type == PLUGLOG_CONNECT_SUCCESS) {
supdup->socket_connected = true;
if (supdup->ldisc)
ldisc_check_sendok(supdup->ldisc);
if (is_tempseat(supdup->seat)) {
Seat *ts = supdup->seat;
tempseat_flush(ts);
@ -893,6 +896,8 @@ static bool supdup_ldisc(Backend *be, int option)
static void supdup_provide_ldisc(Backend *be, Ldisc *ldisc)
{
Supdup *supdup = container_of(be, Supdup, backend);
supdup->ldisc = ldisc;
}
static int supdup_exitcode(Backend *be)

View File

@ -628,6 +628,8 @@ static void telnet_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
telnet->socket_connected);
if (type == PLUGLOG_CONNECT_SUCCESS) {
telnet->socket_connected = true;
if (telnet->ldisc)
ldisc_check_sendok(telnet->ldisc);
if (is_tempseat(telnet->seat)) {
Seat *ts = telnet->seat;
tempseat_flush(ts);