mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32: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:
@ -207,16 +207,14 @@ static void raw_reconfig(Backend *be, Conf *conf)
|
||||
/*
|
||||
* Called to send data down the raw connection.
|
||||
*/
|
||||
static size_t raw_send(Backend *be, const char *buf, size_t len)
|
||||
static void raw_send(Backend *be, const char *buf, size_t len)
|
||||
{
|
||||
Raw *raw = container_of(be, Raw, backend);
|
||||
|
||||
if (raw->s == NULL)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
raw->bufsize = sk_write(raw->s, buf, len);
|
||||
|
||||
return raw->bufsize;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -269,13 +269,13 @@ static void rlogin_reconfig(Backend *be, Conf *conf)
|
||||
/*
|
||||
* Called to send data down the rlogin connection.
|
||||
*/
|
||||
static size_t rlogin_send(Backend *be, const char *buf, size_t len)
|
||||
static void rlogin_send(Backend *be, const char *buf, size_t len)
|
||||
{
|
||||
Rlogin *rlogin = container_of(be, Rlogin, backend);
|
||||
bufchain bc;
|
||||
|
||||
if (rlogin->s == NULL)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
bufchain_init(&bc);
|
||||
bufchain_add(&bc, buf, len);
|
||||
@ -305,8 +305,6 @@ static size_t rlogin_send(Backend *be, const char *buf, size_t len)
|
||||
}
|
||||
|
||||
bufchain_clear(&bc);
|
||||
|
||||
return rlogin->bufsize;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -797,14 +797,14 @@ static void supdup_reconfig(Backend *be, Conf *conf)
|
||||
/*
|
||||
* Called to send data down the Supdup connection.
|
||||
*/
|
||||
static size_t supdup_send(Backend *be, const char *buf, size_t len)
|
||||
static void supdup_send(Backend *be, const char *buf, size_t len)
|
||||
{
|
||||
Supdup *supdup = container_of(be, Supdup, backend);
|
||||
char c;
|
||||
int i;
|
||||
|
||||
if (supdup->s == NULL)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (buf[i] == 034)
|
||||
@ -814,7 +814,6 @@ static size_t supdup_send(Backend *be, const char *buf, size_t len)
|
||||
supdup->bufsize = sk_write(supdup->s, &c, 1);
|
||||
}
|
||||
}
|
||||
return supdup->bufsize;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -813,7 +813,7 @@ static void telnet_reconfig(Backend *be, Conf *conf)
|
||||
/*
|
||||
* Called to send data down the Telnet connection.
|
||||
*/
|
||||
static size_t telnet_send(Backend *be, const char *buf, size_t len)
|
||||
static void telnet_send(Backend *be, const char *buf, size_t len)
|
||||
{
|
||||
Telnet *telnet = container_of(be, Telnet, backend);
|
||||
unsigned char *p, *end;
|
||||
@ -824,7 +824,7 @@ static size_t telnet_send(Backend *be, const char *buf, size_t len)
|
||||
#endif
|
||||
|
||||
if (telnet->s == NULL)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
p = (unsigned char *)buf;
|
||||
end = (unsigned char *)(buf + len);
|
||||
@ -841,8 +841,6 @@ static size_t telnet_send(Backend *be, const char *buf, size_t len)
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
return telnet->bufsize;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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) {
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user