diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-09 16:09:51 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2015-09-17 13:52:39 +0100 |
commit | 634f3188e7f3c104cc7b13a078059f15f3f4a68a (patch) | |
tree | 6af88cc76dc4181cd034b0b2f3114ffe6e359234 /clientloop.c | |
parent | 654750762053d631bd1e1176c230eaeaad9b4250 (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.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/clientloop.c b/clientloop.c index 77d549822..964353dc3 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -577,16 +577,21 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt) | |||
577 | static void | 577 | static void |
578 | server_alive_check(void) | 578 | server_alive_check(void) |
579 | { | 579 | { |
580 | if (packet_inc_alive_timeouts() > options.server_alive_count_max) { | 580 | if (compat20) { |
581 | logit("Timeout, server %s not responding.", host); | 581 | if (packet_inc_alive_timeouts() > options.server_alive_count_max) { |
582 | cleanup_exit(255); | 582 | logit("Timeout, server %s not responding.", host); |
583 | cleanup_exit(255); | ||
584 | } | ||
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 | } else { | ||
592 | packet_send_ignore(0); | ||
593 | packet_send(); | ||
583 | } | 594 | } |
584 | packet_start(SSH2_MSG_GLOBAL_REQUEST); | ||
585 | packet_put_cstring("keepalive@openssh.com"); | ||
586 | packet_put_char(1); /* boolean: want reply */ | ||
587 | packet_send(); | ||
588 | /* Insert an empty placeholder to maintain ordering */ | ||
589 | client_register_global_confirm(NULL, NULL); | ||
590 | } | 595 | } |
591 | 596 | ||
592 | /* | 597 | /* |
@@ -648,7 +653,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, | |||
648 | */ | 653 | */ |
649 | 654 | ||
650 | timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ | 655 | timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ |
651 | if (options.server_alive_interval > 0 && compat20) { | 656 | if (options.server_alive_interval > 0) { |
652 | timeout_secs = options.server_alive_interval; | 657 | timeout_secs = options.server_alive_interval; |
653 | server_alive_time = now + options.server_alive_interval; | 658 | server_alive_time = now + options.server_alive_interval; |
654 | } | 659 | } |