[BACK]Return to clientloop.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/clientloop.c between version 1.221 and 1.222

version 1.221, 2010/06/25 23:15:36 version 1.222, 2010/07/19 09:15:12
Line 137 
Line 137 
 /* Flag indicating whether the user's terminal is in non-blocking mode. */  /* Flag indicating whether the user's terminal is in non-blocking mode. */
 static int in_non_blocking_mode = 0;  static int in_non_blocking_mode = 0;
   
   /* Time when backgrounded control master using ControlPersist should exit */
   static time_t control_persist_exit_time = 0;
   
 /* Common data for the client loop code. */  /* Common data for the client loop code. */
 volatile sig_atomic_t quit_pending; /* Set non-zero to quit the loop. */  volatile sig_atomic_t quit_pending; /* Set non-zero to quit the loop. */
 static int escape_char1;        /* Escape character. (proto1 only) */  static int escape_char1;        /* Escape character. (proto1 only) */
Line 244 
Line 247 
         return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0;          return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0;
 }  }
   
   /*
    * Sets control_persist_exit_time to the absolute time when the
    * backgrounded control master should exit due to expiry of the
    * ControlPersist timeout.  Sets it to 0 if we are not a backgrounded
    * control master process, or if there is no ControlPersist timeout.
    */
   static void
   set_control_persist_exit_time(void)
   {
           if (muxserver_sock == -1 || !options.control_persist
               || options.control_persist_timeout == 0)
                   /* not using a ControlPersist timeout */
                   control_persist_exit_time = 0;
           else if (channel_still_open()) {
                   /* some client connections are still open */
                   if (control_persist_exit_time > 0)
                           debug2("%s: cancel scheduled exit", __func__);
                   control_persist_exit_time = 0;
           } else if (control_persist_exit_time <= 0) {
                   /* a client connection has recently closed */
                   control_persist_exit_time = time(NULL) +
                           (time_t)options.control_persist_timeout;
                   debug2("%s: schedule exit in %d seconds", __func__,
                       options.control_persist_timeout);
           }
           /* else we are already counting down to the timeout */
   }
   
 #define SSH_X11_PROTO "MIT-MAGIC-COOKIE-1"  #define SSH_X11_PROTO "MIT-MAGIC-COOKIE-1"
 void  void
 client_x11_get_proto(const char *display, const char *xauth_path,  client_x11_get_proto(const char *display, const char *xauth_path,
Line 525 
Line 556 
     int *maxfdp, u_int *nallocp, int rekeying)      int *maxfdp, u_int *nallocp, int rekeying)
 {  {
         struct timeval tv, *tvp;          struct timeval tv, *tvp;
           int timeout_secs;
         int ret;          int ret;
   
         /* Add any selections by the channel mechanism. */          /* Add any selections by the channel mechanism. */
Line 568 
Line 600 
         /*          /*
          * Wait for something to happen.  This will suspend the process until           * Wait for something to happen.  This will suspend the process until
          * some selected descriptor can be read, written, or has some other           * some selected descriptor can be read, written, or has some other
          * event pending.           * event pending, or a timeout expires.
          */           */
   
         if (options.server_alive_interval == 0 || !compat20)          timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */
           if (options.server_alive_interval > 0 && compat20)
                   timeout_secs = options.server_alive_interval;
           set_control_persist_exit_time();
           if (control_persist_exit_time > 0) {
                   timeout_secs = MIN(timeout_secs,
                           control_persist_exit_time - time(NULL));
                   if (timeout_secs < 0)
                           timeout_secs = 0;
           }
           if (timeout_secs == INT_MAX)
                 tvp = NULL;                  tvp = NULL;
         else {          else {
                 tv.tv_sec = options.server_alive_interval;                  tv.tv_sec = timeout_secs;
                 tv.tv_usec = 0;                  tv.tv_usec = 0;
                 tvp = &tv;                  tvp = &tv;
         }          }
   
         ret = select((*maxfdp)+1, *readsetp, *writesetp, NULL, tvp);          ret = select((*maxfdp)+1, *readsetp, *writesetp, NULL, tvp);
         if (ret < 0) {          if (ret < 0) {
                 char buf[100];                  char buf[100];
Line 1466 
Line 1509 
                  */                   */
                 if (FD_ISSET(connection_out, writeset))                  if (FD_ISSET(connection_out, writeset))
                         packet_write_poll();                          packet_write_poll();
   
                   /*
                    * If we are a backgrounded control master, and the
                    * timeout has expired without any active client
                    * connections, then quit.
                    */
                   if (control_persist_exit_time > 0) {
                           if (time(NULL) >= control_persist_exit_time) {
                                   debug("ControlPersist timeout expired");
                                   break;
                           }
                   }
         }          }
         if (readset)          if (readset)
                 xfree(readset);                  xfree(readset);

Legend:
Removed from v.1.221  
changed lines
  Added in v.1.222