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