summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-02-09 16:09:51 +0000
committerColin Watson <cjwatson@debian.org>2015-11-29 17:36:18 +0000
commit5e3b425ba1e334c987c5e15abf3d90e9eb776ab3 (patch)
tree1dd98207b0a4525c16fe5157fdfea3c13c8e63b6 /clientloop.c
parent250d744e08a4f88cd547023cb2f036b2cdfd569b (diff)
Partial server keep-alive implementation for SSH1
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1712 Last-Update: 2013-09-14 Patch-Name: ssh1-keepalive.patch
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/clientloop.c b/clientloop.c
index fba1b5496..9e45d24e0 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -578,16 +578,21 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
578static void 578static void
579server_alive_check(void) 579server_alive_check(void)
580{ 580{
581 if (packet_inc_alive_timeouts() > options.server_alive_count_max) { 581 if (compat20) {
582 logit("Timeout, server %s not responding.", host); 582 if (packet_inc_alive_timeouts() > options.server_alive_count_max) {
583 cleanup_exit(255); 583 logit("Timeout, server %s not responding.", host);
584 cleanup_exit(255);
585 }
586 packet_start(SSH2_MSG_GLOBAL_REQUEST);
587 packet_put_cstring("keepalive@openssh.com");
588 packet_put_char(1); /* boolean: want reply */
589 packet_send();
590 /* Insert an empty placeholder to maintain ordering */
591 client_register_global_confirm(NULL, NULL);
592 } else {
593 packet_send_ignore(0);
594 packet_send();
584 } 595 }
585 packet_start(SSH2_MSG_GLOBAL_REQUEST);
586 packet_put_cstring("keepalive@openssh.com");
587 packet_put_char(1); /* boolean: want reply */
588 packet_send();
589 /* Insert an empty placeholder to maintain ordering */
590 client_register_global_confirm(NULL, NULL);
591} 596}
592 597
593/* 598/*
@@ -649,7 +654,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
649 */ 654 */
650 655
651 timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ 656 timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */
652 if (options.server_alive_interval > 0 && compat20) { 657 if (options.server_alive_interval > 0) {
653 timeout_secs = options.server_alive_interval; 658 timeout_secs = options.server_alive_interval;
654 server_alive_time = now + options.server_alive_interval; 659 server_alive_time = now + options.server_alive_interval;
655 } 660 }