]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
- markus@cvs.openbsd.org 2001/10/04 15:12:37
authorDamien Miller <djm@mindrot.org>
Wed, 10 Oct 2001 05:01:40 +0000 (15:01 +1000)
committerDamien Miller <djm@mindrot.org>
Wed, 10 Oct 2001 05:01:40 +0000 (15:01 +1000)
     [serverloop.c]
     client_alive_check cleanup

ChangeLog
serverloop.c

index 8970ba1e0c5bd451b00c90c74008488c2c499404..afb752b9d7ca1ac8a0530ee44f04d542c7eee5b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
    - markus@cvs.openbsd.org 2001/10/04 15:05:40
      [channels.c serverloop.c]
      comment out bogus conditions for selecting on connection_in
+   - markus@cvs.openbsd.org 2001/10/04 15:12:37
+     [serverloop.c]
+     client_alive_check cleanup
 
 20011007
  - (bal) ssh-copy-id corrected permissions for .ssh/ and authorized_keys.
  - Wrote replacements for strlcpy and mkdtemp
  - Released 1.0pre1
 
-$Id: ChangeLog,v 1.1586 2001/10/10 05:01:16 djm Exp $
+$Id: ChangeLog,v 1.1587 2001/10/10 05:01:40 djm Exp $
index 049ea4e463f6ba0be629f8ee34f69bde76a90d1b..4577cc804adff9fa7e5562fb8d0053a64fc5f659 100644 (file)
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.78 2001/10/04 15:05:40 markus Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.79 2001/10/04 15:12:37 markus Exp $");
 
 #include "xmalloc.h"
 #include "packet.h"
@@ -80,6 +80,7 @@ static int connection_in;     /* Connection to client (input). */
 static int connection_out;     /* Connection to client (output). */
 static int connection_closed = 0;      /* Connection to client closed. */
 static u_int buffer_high;      /* "Soft" max buffer size. */
+static int client_alive_timeouts = 0;
 
 /*
  * This SIGCHLD kludge is used to detect when the child exits.  The server
@@ -91,8 +92,6 @@ static volatile int child_terminated; /* The child has terminated. */
 /* prototypes */
 static void server_init_dispatch(void);
 
-int client_alive_timeouts = 0;
-
 static void
 sigchld_handler(int sig)
 {
@@ -161,6 +160,26 @@ make_packets_from_stdout_data(void)
        }
 }
 
+static void
+client_alive_check(void)
+{
+       int id;
+
+       /* timeout, check to see how many we have had */
+       if (++client_alive_timeouts > options.client_alive_count_max)
+               packet_disconnect("Timeout, your session not responding.");
+
+       id = channel_find_open();
+       if (id == -1)
+               packet_disconnect("No open channels after timeout!");
+       /*
+        * send a bogus channel request with "wantreply",
+        * we should get back a failure
+        */
+       channel_request_start(id, "keepalive@openssh.com", 1);
+       packet_send();
+}
+
 /*
  * Sleep in select() until we can do something.  This will initialize the
  * select masks.  Upon return, the masks will indicate which descriptors
@@ -261,30 +280,8 @@ retry_select:
                else
                        goto retry_select;
        }
-       if (ret == 0 && client_alive_scheduled) {
-               /* timeout, check to see how many we have had */
-               client_alive_timeouts++;
-
-               if (client_alive_timeouts > options.client_alive_count_max ) {
-                       packet_disconnect(
-                               "Timeout, your session not responding.");
-               } else {
-                       /*
-                        * send a bogus channel request with "wantreply" 
-                        * we should get back a failure
-                        */
-                       int id;
-                       
-                       id = channel_find_open();
-                       if (id != -1) {
-                               channel_request_start(id,
-                                 "keepalive@openssh.com", 1);
-                               packet_send();
-                       } else 
-                               packet_disconnect(
-                                       "No open channels after timeout!");
-               }
-       } 
+       if (ret == 0 && client_alive_scheduled)
+               client_alive_check();
 }
 
 /*