summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/serverloop.c b/serverloop.c
index cd9368d07..d6b360d9a 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.59 2001/04/05 10:42:51 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.60 2001/04/05 23:39:20 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -77,7 +77,8 @@ static int fderr_eof = 0; /* EOF encountered readung from fderr. */
77static int fdin_is_tty = 0; /* fdin points to a tty. */ 77static int fdin_is_tty = 0; /* fdin points to a tty. */
78static int connection_in; /* Connection to client (input). */ 78static int connection_in; /* Connection to client (input). */
79static int connection_out; /* Connection to client (output). */ 79static int connection_out; /* Connection to client (output). */
80static u_int buffer_high;/* "Soft" max buffer size. */ 80static int connection_closed = 0; /* Connection to client closed. */
81static u_int buffer_high; /* "Soft" max buffer size. */
81 82
82/* 83/*
83 * This SIGCHLD kludge is used to detect when the child exits. The server 84 * This SIGCHLD kludge is used to detect when the child exits. The server
@@ -277,6 +278,9 @@ process_input(fd_set * readset)
277 len = read(connection_in, buf, sizeof(buf)); 278 len = read(connection_in, buf, sizeof(buf));
278 if (len == 0) { 279 if (len == 0) {
279 verbose("Connection closed by remote host."); 280 verbose("Connection closed by remote host.");
281 connection_closed = 1;
282 if (compat20)
283 return;
280 fatal_cleanup(); 284 fatal_cleanup();
281 } else if (len < 0) { 285 } else if (len < 0) {
282 if (errno != EINTR && errno != EAGAIN) { 286 if (errno != EINTR && errno != EAGAIN) {
@@ -650,7 +654,7 @@ void
650server_loop2(void) 654server_loop2(void)
651{ 655{
652 fd_set *readset = NULL, *writeset = NULL; 656 fd_set *readset = NULL, *writeset = NULL;
653 int had_channel = 0, rekeying = 0, max_fd, status; 657 int rekeying = 0, max_fd, status;
654 pid_t pid; 658 pid_t pid;
655 659
656 debug("Entering interactive session for SSH2."); 660 debug("Entering interactive session for SSH2.");
@@ -669,12 +673,6 @@ server_loop2(void)
669 673
670 rekeying = (xxx_kex != NULL && !xxx_kex->done); 674 rekeying = (xxx_kex != NULL && !xxx_kex->done);
671 675
672 if (!had_channel && channel_still_open())
673 had_channel = 1;
674 if (had_channel && !channel_still_open()) {
675 debug("!channel_still_open.");
676 break;
677 }
678 if (!rekeying && packet_not_very_much_data_to_write()) 676 if (!rekeying && packet_not_very_much_data_to_write())
679 channel_output_poll(); 677 channel_output_poll();
680 wait_until_can_do_something(&readset, &writeset, &max_fd, 678 wait_until_can_do_something(&readset, &writeset, &max_fd,
@@ -687,6 +685,8 @@ server_loop2(void)
687 if (!rekeying) 685 if (!rekeying)
688 channel_after_select(readset, writeset); 686 channel_after_select(readset, writeset);
689 process_input(readset); 687 process_input(readset);
688 if (connection_closed)
689 break;
690 process_output(writeset); 690 process_output(writeset);
691 } 691 }
692 if (readset) 692 if (readset)