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 52667017c..16a162803 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -501,16 +501,21 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
501static void 501static void
502server_alive_check(void) 502server_alive_check(void)
503{ 503{
504 if (++keep_alive_timeouts > options.server_alive_count_max) { 504 if (compat20) {
505 logit("Timeout, server not responding."); 505 if (++keep_alive_timeouts > options.server_alive_count_max) {
506 cleanup_exit(255); 506 logit("Timeout, server not responding.");
507 cleanup_exit(255);
508 }
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 } else {
516 packet_send_ignore(0);
517 packet_send();
507 } 518 }
508 packet_start(SSH2_MSG_GLOBAL_REQUEST);
509 packet_put_cstring("keepalive@openssh.com");
510 packet_put_char(1); /* boolean: want reply */
511 packet_send();
512 /* Insert an empty placeholder to maintain ordering */
513 client_register_global_confirm(NULL, NULL);
514} 519}
515 520
516/* 521/*
@@ -571,7 +576,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
571 * event pending. 576 * event pending.
572 */ 577 */
573 578
574 if (options.server_alive_interval == 0 || !compat20) 579 if (options.server_alive_interval == 0)
575 tvp = NULL; 580 tvp = NULL;
576 else { 581 else {
577 tv.tv_sec = options.server_alive_interval; 582 tv.tv_sec = options.server_alive_interval;
@@ -1510,14 +1515,16 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1510 exit_status = 0; 1515 exit_status = 0;
1511 } 1516 }
1512 1517
1513 if (received_signal) 1518 if (received_signal) {
1514 fatal("Killed by signal %d.", (int) received_signal); 1519 debug("Killed by signal %d.", (int) received_signal);
1520 cleanup_exit((int) received_signal + 128);
1521 }
1515 1522
1516 /* 1523 /*
1517 * In interactive mode (with pseudo tty) display a message indicating 1524 * In interactive mode (with pseudo tty) display a message indicating
1518 * that the connection has been closed. 1525 * that the connection has been closed.
1519 */ 1526 */
1520 if (have_pty && options.log_level != SYSLOG_LEVEL_QUIET) { 1527 if (have_pty && options.log_level > SYSLOG_LEVEL_QUIET) {
1521 snprintf(buf, sizeof buf, 1528 snprintf(buf, sizeof buf,
1522 "Connection to %.64s closed.\r\n", host); 1529 "Connection to %.64s closed.\r\n", host);
1523 buffer_append(&stderr_buffer, buf, strlen(buf)); 1530 buffer_append(&stderr_buffer, buf, strlen(buf));