From 18896b662e4225b2b2185d49bc916891f1fdbef5 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 30 Mar 2022 18:15:43 +0100 Subject: [PATCH] sshproxy: call backend_unthrottle on unfreeze. If an SSH proxy socket is frozen for long enough, and the SSH server continues to send, then sooner or later the proxy SSH connection will end up having to freeze its underlying physical socket too. When the proxy socket is later unfrozen, it needs to pass that unfreezing on in turn. The way this should happen is that when the SshProxy begins to clear the backlog of data passed to it from the proxy SSH connection via seat_stdout, it should call backend_unthrottle to inform that proxy connection that the backlog is clearing. But there was no backlog_unthrottle call in the whole of sshproxy.c. Now there is. --- proxy/sshproxy.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/proxy/sshproxy.c b/proxy/sshproxy.c index 4f240d50..95daecb1 100644 --- a/proxy/sshproxy.c +++ b/proxy/sshproxy.c @@ -100,12 +100,20 @@ static void sshproxy_write_eof(Socket *s) static void try_send_ssh_to_socket(void *ctx); +static void try_send_ssh_to_socket_cb(void *ctx) +{ + SshProxy *sp = (SshProxy *)ctx; + try_send_ssh_to_socket(sp); + if (sp->backend) + backend_unthrottle(sp->backend, bufchain_size(&sp->ssh_to_socket)); +} + static void sshproxy_set_frozen(Socket *s, bool is_frozen) { SshProxy *sp = container_of(s, SshProxy, sock); sp->frozen = is_frozen; if (!sp->frozen) - queue_toplevel_callback(try_send_ssh_to_socket, sp); + queue_toplevel_callback(try_send_ssh_to_socket_cb, sp); } static const char *sshproxy_socket_error(Socket *s)