mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-12 00:33:53 -05:00
Work around unhelpful GTK event ordering.
If the SSH socket is readable, GTK will preferentially give us a callback to read from it rather than calling its idle functions. That means the ssh->in_raw bufchain can just keep accumulating data, and the callback that gets the BPP to take data back off that bufchain will never be called at all. The solution is to use sk_set_frozen after a certain point, to stop reading further data from the socket (and, more importantly, disable GTK's I/O callback for that fd) until we've had a chance to process some backlog, and then unfreeze the socket again afterwards. Annoyingly, that means adding a _second_ 'frozen' flag to Ssh, because the one we already had has exactly the wrong semantics - it prevents us from _processing_ our backlog, which is the last thing we want if the entire problem is that we need that backlog to get smaller! So now there are two frozen flags, and a big comment explaining the difference.
This commit is contained in:
@ -822,7 +822,11 @@ void ssh_ppl_user_output_string_and_free(PacketProtocolLayer *ppl, char *text)
|
||||
static void ssh_bpp_input_raw_data_callback(void *context)
|
||||
{
|
||||
BinaryPacketProtocol *bpp = (BinaryPacketProtocol *)context;
|
||||
Ssh *ssh = bpp->ssh; /* in case bpp is about to get freed */
|
||||
ssh_bpp_handle_input(bpp);
|
||||
/* If we've now cleared enough backlog on the input connection, we
|
||||
* may need to unfreeze it. */
|
||||
ssh_conn_processed_data(ssh);
|
||||
}
|
||||
|
||||
static void ssh_bpp_output_packet_callback(void *context)
|
||||
|
Reference in New Issue
Block a user