mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
New Seat callback, seat_sent().
This is used to notify the Seat that some data has been cleared from the backend's outgoing data buffer. In other words, it notifies the Seat that it might be worth calling backend_sendbuffer() again. We've never needed this before, because until now, Seats have always been the 'main program' part of the application, meaning they were also in control of the event loop. So they've been able to call backend_sendbuffer() proactively, every time they go round the event loop, instead of having to wait for a callback. But now, the SSH proxy is the first example of a Seat without privileged access to the event loop, so it has no way to find out that the backend's sendbuffer has got smaller. And without that, it can't pass that notification on to plug_sent, to unblock in turn whatever the proxied connection might have been waiting to send. In fact, before this commit, sshproxy.c never called plug_sent at all. As a result, large data uploads over an SSH jump host would hang forever as soon as the outgoing buffer filled up for the first time: the main backend (to which sshproxy.c was acting as a Socket) would carefully stop filling up the buffer, and then never receive the call to plug_sent that would cause it to start again. The new callback is ignored everywhere except in sshproxy.c. It might be a good idea to remove backend_sendbuffer() entirely and convert all previous uses of it into non-empty implementations of this callback, so that we've only got one system; but for the moment, I haven't done that.
This commit is contained in:
14
putty.h
14
putty.h
@ -886,6 +886,17 @@ struct SeatVtable {
|
||||
*/
|
||||
bool (*eof)(Seat *seat);
|
||||
|
||||
/*
|
||||
* Called by the back end to notify that the output backlog has
|
||||
* changed size. A front end in control of the event loop won't
|
||||
* necessarily need this (they can just keep checking it via
|
||||
* backend_sendbuffer at every opportunity), but one buried in the
|
||||
* depths of something else (like an SSH proxy) will need to be
|
||||
* proactively notified that the amount of buffered data has
|
||||
* become smaller.
|
||||
*/
|
||||
void (*sent)(Seat *seat, size_t new_sendbuffer);
|
||||
|
||||
/*
|
||||
* Try to get answers from a set of interactive login prompts. The
|
||||
* prompts are provided in 'p'; the bufchain 'input' holds the
|
||||
@ -1117,6 +1128,8 @@ static inline size_t seat_output(
|
||||
{ return seat->vt->output(seat, err, data, len); }
|
||||
static inline bool seat_eof(Seat *seat)
|
||||
{ return seat->vt->eof(seat); }
|
||||
static inline void seat_sent(Seat *seat, size_t bufsize)
|
||||
{ seat->vt->sent(seat, bufsize); }
|
||||
static inline int seat_get_userpass_input(
|
||||
Seat *seat, prompts_t *p, bufchain *input)
|
||||
{ return seat->vt->get_userpass_input(seat, p, input); }
|
||||
@ -1190,6 +1203,7 @@ static inline size_t seat_stderr_pl(Seat *seat, ptrlen data)
|
||||
size_t nullseat_output(
|
||||
Seat *seat, bool is_stderr, const void *data, size_t len);
|
||||
bool nullseat_eof(Seat *seat);
|
||||
void nullseat_sent(Seat *seat, size_t bufsize);
|
||||
int nullseat_get_userpass_input(Seat *seat, prompts_t *p, bufchain *input);
|
||||
void nullseat_notify_remote_exit(Seat *seat);
|
||||
void nullseat_notify_remote_disconnect(Seat *seat);
|
||||
|
Reference in New Issue
Block a user