summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/clientloop.c b/clientloop.c
index b57fda042..aa8697900 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -474,14 +474,19 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
474static void 474static void
475server_alive_check(void) 475server_alive_check(void)
476{ 476{
477 if (++server_alive_timeouts > options.server_alive_count_max) { 477 if (compat20) {
478 logit("Timeout, server not responding."); 478 if (++server_alive_timeouts > options.server_alive_count_max) {
479 cleanup_exit(255); 479 logit("Timeout, server not responding.");
480 cleanup_exit(255);
481 }
482 packet_start(SSH2_MSG_GLOBAL_REQUEST);
483 packet_put_cstring("keepalive@openssh.com");
484 packet_put_char(1); /* boolean: want reply */
485 packet_send();
486 } else {
487 packet_send_ignore(0);
488 packet_send();
480 } 489 }
481 packet_start(SSH2_MSG_GLOBAL_REQUEST);
482 packet_put_cstring("keepalive@openssh.com");
483 packet_put_char(1); /* boolean: want reply */
484 packet_send();
485} 490}
486 491
487/* 492/*
@@ -542,7 +547,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
542 * event pending. 547 * event pending.
543 */ 548 */
544 549
545 if (options.server_alive_interval == 0 || !compat20) 550 if (options.server_alive_interval == 0)
546 tvp = NULL; 551 tvp = NULL;
547 else { 552 else {
548 tv.tv_sec = options.server_alive_interval; 553 tv.tv_sec = options.server_alive_interval;
@@ -1558,14 +1563,16 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1558 exit_status = 0; 1563 exit_status = 0;
1559 } 1564 }
1560 1565
1561 if (received_signal) 1566 if (received_signal) {
1562 fatal("Killed by signal %d.", (int) received_signal); 1567 debug("Killed by signal %d.", (int) received_signal);
1568 cleanup_exit((int) received_signal + 128);
1569 }
1563 1570
1564 /* 1571 /*
1565 * In interactive mode (with pseudo tty) display a message indicating 1572 * In interactive mode (with pseudo tty) display a message indicating
1566 * that the connection has been closed. 1573 * that the connection has been closed.
1567 */ 1574 */
1568 if (have_pty && options.log_level != SYSLOG_LEVEL_QUIET) { 1575 if (have_pty && options.log_level > SYSLOG_LEVEL_QUIET) {
1569 snprintf(buf, sizeof buf, "Connection to %.64s closed.\r\n", host); 1576 snprintf(buf, sizeof buf, "Connection to %.64s closed.\r\n", host);
1570 buffer_append(&stderr_buffer, buf, strlen(buf)); 1577 buffer_append(&stderr_buffer, buf, strlen(buf));
1571 } 1578 }