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

Separate backend_send from backend_sendbuffer.

On a similar theme of separating the query operation from the
attempted change, backend_send() now no longer has the side effect of
returning the current size of the send buffer. Instead, you have to
call backend_sendbuffer() every time you want to know that.
This commit is contained in:
Simon Tatham
2021-09-12 09:52:46 +01:00
parent 82177956da
commit c336643576
15 changed files with 44 additions and 49 deletions

View File

@ -39,9 +39,10 @@ static char *loop_init(const BackendVtable *, Seat *, Backend **, LogContext *,
static void null_free(Backend *);
static void loop_free(Backend *);
static void null_reconfig(Backend *, Conf *);
static size_t null_send(Backend *, const char *, size_t);
static size_t loop_send(Backend *, const char *, size_t);
static void null_send(Backend *, const char *, size_t);
static void loop_send(Backend *, const char *, size_t);
static size_t null_sendbuffer(Backend *);
static size_t loop_sendbuffer(Backend *);
static void null_size(Backend *, int, int);
static void null_special(Backend *, SessionSpecialCode, int);
static const SessionSpecial *null_get_specials(Backend *);
@ -80,7 +81,7 @@ const BackendVtable loop_backend = {
.free = loop_free,
.reconfig = null_reconfig,
.send = loop_send,
.sendbuffer = null_sendbuffer,
.sendbuffer = loop_sendbuffer,
.size = null_size,
.special = null_special,
.get_specials = null_get_specials,
@ -100,6 +101,7 @@ const BackendVtable loop_backend = {
struct loop_state {
Seat *seat;
Backend backend;
size_t sendbuffer;
};
static char *null_init(const BackendVtable *vt, Seat *seat,
@ -143,15 +145,14 @@ static void null_reconfig(Backend *be, Conf *conf) {
}
static size_t null_send(Backend *be, const char *buf, size_t len) {
static void null_send(Backend *be, const char *buf, size_t len) {
return 0;
}
static size_t loop_send(Backend *be, const char *buf, size_t len) {
static void loop_send(Backend *be, const char *buf, size_t len) {
struct loop_state *st = container_of(be, struct loop_state, backend);
return seat_output(st->seat, 0, buf, len);
st->sendbuffer = seat_output(st->seat, 0, buf, len);
}
static size_t null_sendbuffer(Backend *be) {
@ -159,6 +160,12 @@ static size_t null_sendbuffer(Backend *be) {
return 0;
}
static size_t loop_sendbuffer(Backend *be) {
struct loop_state *st = container_of(be, struct loop_state, backend);
return st->sendbuffer;
}
static void null_size(Backend *be, int width, int height) {
}