diff options
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/clientloop.c b/clientloop.c index e5ea74e26..a55fe9995 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -507,16 +507,21 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt) | |||
507 | static void | 507 | static void |
508 | server_alive_check(void) | 508 | server_alive_check(void) |
509 | { | 509 | { |
510 | if (packet_inc_alive_timeouts() > options.server_alive_count_max) { | 510 | if (compat20) { |
511 | logit("Timeout, server not responding."); | 511 | if (packet_inc_alive_timeouts() > options.server_alive_count_max) { |
512 | cleanup_exit(255); | 512 | logit("Timeout, server not responding."); |
513 | cleanup_exit(255); | ||
514 | } | ||
515 | packet_start(SSH2_MSG_GLOBAL_REQUEST); | ||
516 | packet_put_cstring("keepalive@openssh.com"); | ||
517 | packet_put_char(1); /* boolean: want reply */ | ||
518 | packet_send(); | ||
519 | /* Insert an empty placeholder to maintain ordering */ | ||
520 | client_register_global_confirm(NULL, NULL); | ||
521 | } else { | ||
522 | packet_send_ignore(0); | ||
523 | packet_send(); | ||
513 | } | 524 | } |
514 | packet_start(SSH2_MSG_GLOBAL_REQUEST); | ||
515 | packet_put_cstring("keepalive@openssh.com"); | ||
516 | packet_put_char(1); /* boolean: want reply */ | ||
517 | packet_send(); | ||
518 | /* Insert an empty placeholder to maintain ordering */ | ||
519 | client_register_global_confirm(NULL, NULL); | ||
520 | } | 525 | } |
521 | 526 | ||
522 | /* | 527 | /* |
@@ -574,7 +579,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, | |||
574 | * event pending. | 579 | * event pending. |
575 | */ | 580 | */ |
576 | 581 | ||
577 | if (options.server_alive_interval == 0 || !compat20) | 582 | if (options.server_alive_interval == 0) |
578 | tvp = NULL; | 583 | tvp = NULL; |
579 | else { | 584 | else { |
580 | tv.tv_sec = options.server_alive_interval; | 585 | tv.tv_sec = options.server_alive_interval; |
@@ -1524,14 +1529,16 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1524 | exit_status = 0; | 1529 | exit_status = 0; |
1525 | } | 1530 | } |
1526 | 1531 | ||
1527 | if (received_signal) | 1532 | if (received_signal) { |
1528 | fatal("Killed by signal %d.", (int) received_signal); | 1533 | debug("Killed by signal %d.", (int) received_signal); |
1534 | cleanup_exit((int) received_signal + 128); | ||
1535 | } | ||
1529 | 1536 | ||
1530 | /* | 1537 | /* |
1531 | * In interactive mode (with pseudo tty) display a message indicating | 1538 | * In interactive mode (with pseudo tty) display a message indicating |
1532 | * that the connection has been closed. | 1539 | * that the connection has been closed. |
1533 | */ | 1540 | */ |
1534 | if (have_pty && options.log_level != SYSLOG_LEVEL_QUIET) { | 1541 | if (have_pty && options.log_level > SYSLOG_LEVEL_QUIET) { |
1535 | snprintf(buf, sizeof buf, | 1542 | snprintf(buf, sizeof buf, |
1536 | "Connection to %.64s closed.\r\n", host); | 1543 | "Connection to %.64s closed.\r\n", host); |
1537 | buffer_append(&stderr_buffer, buf, strlen(buf)); | 1544 | buffer_append(&stderr_buffer, buf, strlen(buf)); |