From 9c3cc0e264fcd8bd72f4ce782a707794f9845c55 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Wed, 9 Oct 2019 18:45:20 -0400 Subject: [PATCH] Renable keepalive now that libssh allows it --- Dockerfile.dev | 2 +- tmate-ssh-latency.c | 7 ++++--- tmate.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 1a21a73f..ab31cd4f 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -22,7 +22,7 @@ COPY . . RUN set -ex; \ ./autogen.sh; \ - ./configure --prefix=/usr CFLAGS="-D_GNU_SOURCE"; \ + ./configure --enable-latency --prefix=/usr CFLAGS="-D_GNU_SOURCE"; \ make -j "$(nproc)"; \ ln -s /src/tmate-ssh-server/tmate-ssh-server /usr/bin diff --git a/tmate-ssh-latency.c b/tmate-ssh-latency.c index f503adab..d1a95409 100644 --- a/tmate-ssh-latency.c +++ b/tmate-ssh-latency.c @@ -30,10 +30,11 @@ static void on_keepalive_timer(__unused evutil_socket_t fd, struct tmate_ssh_client *client = arg; /* - * libssh-0.8.4 or higher have a broken keepalive implementation due - * to packet filtering. + * libssh 0.8.4, 0.8.5, and 0.8.6 can't handle the response of the + * keepalives due to packet filtering. */ - if (ssh_version(SSH_VERSION_INT(0,8,4))) + + if (ssh_version(SSH_VERSION_INT(0,8,4)) && !ssh_version(SSH_VERSION_INT(0,8,7))) return; if (ssh_send_keepalive(client->session) == SSH_ERROR) diff --git a/tmate.h b/tmate.h index 6e1b9761..368ea56d 100644 --- a/tmate.h +++ b/tmate.h @@ -146,7 +146,7 @@ extern void tmate_flush_pty(struct tmate_session *session); #ifdef ENABLE_LATENCY #define TMATE_SSH_KEEPALIVE 10 #else -#define TMATE_SSH_KEEPALIVE 50 +#define TMATE_SSH_KEEPALIVE 300 #endif #define TMATE_ROLE_DAEMON 1