summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2004-03-05 11:14:29 +0000
committerColin Watson <cjwatson@debian.org>2004-03-05 11:14:29 +0000
commitf8e0d0cb8e77672526baf211bda0b4baae557d33 (patch)
treebca5dae3013f2cffac449bbea7d7b33c2837bee3 /clientloop.c
parenta632758c3a2bff7e6c963cc96603b8880878fd4e (diff)
Implement SSH1 support for ServerAliveInterval using SSH_MSG_IGNORE. As
documented in ssh_config(5), it's not as good as the SSH2 version.
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/clientloop.c b/clientloop.c
index 626b29a5a..a13d06ddf 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -324,12 +324,17 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
324static void 324static void
325server_alive_check(void) 325server_alive_check(void)
326{ 326{
327 if (++server_alive_timeouts > options.server_alive_count_max) 327 if (compat20) {
328 packet_disconnect("Timeout, server not responding."); 328 if (++server_alive_timeouts > options.server_alive_count_max)
329 packet_start(SSH2_MSG_GLOBAL_REQUEST); 329 packet_disconnect("Timeout, server not responding.");
330 packet_put_cstring("keepalive@openssh.com"); 330 packet_start(SSH2_MSG_GLOBAL_REQUEST);
331 packet_put_char(1); /* boolean: want reply */ 331 packet_put_cstring("keepalive@openssh.com");
332 packet_send(); 332 packet_put_char(1); /* boolean: want reply */
333 packet_send();
334 } else {
335 packet_send_ignore(0);
336 packet_send();
337 }
333} 338}
334 339
335/* 340/*
@@ -388,7 +393,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
388 * event pending. 393 * event pending.
389 */ 394 */
390 395
391 if (options.server_alive_interval == 0 || !compat20) 396 if (options.server_alive_interval == 0)
392 tvp = NULL; 397 tvp = NULL;
393 else { 398 else {
394 tv.tv_sec = options.server_alive_interval; 399 tv.tv_sec = options.server_alive_interval;