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

Diff for /src/usr.bin/ssh/channels.c between version 1.83 and 1.84

version 1.83, 2001/01/24 21:03:50 version 1.84, 2001/01/29 16:55:36
Line 84 
Line 84 
  * Maximum file descriptor value used in any of the channels.  This is   * Maximum file descriptor value used in any of the channels.  This is
  * updated in channel_allocate.   * updated in channel_allocate.
  */   */
 static int channel_max_fd_value = 0;  static int channel_max_fd = 0;
   
 /* Name and directory of socket for authentication agent forwarding. */  /* Name and directory of socket for authentication agent forwarding. */
 static char *channel_forwarded_auth_socket_name = NULL;  static char *channel_forwarded_auth_socket_name = NULL;
Line 181 
Line 181 
     int extusage, int nonblock)      int extusage, int nonblock)
 {  {
         /* Update the maximum file descriptor value. */          /* Update the maximum file descriptor value. */
         if (rfd > channel_max_fd_value)          channel_max_fd = MAX(channel_max_fd, rfd);
                 channel_max_fd_value = rfd;          channel_max_fd = MAX(channel_max_fd, wfd);
         if (wfd > channel_max_fd_value)          channel_max_fd = MAX(channel_max_fd, efd);
                 channel_max_fd_value = wfd;  
         if (efd > channel_max_fd_value)  
                 channel_max_fd_value = efd;  
         /* XXX set close-on-exec -markus */          /* XXX set close-on-exec -markus */
   
         c->rfd = rfd;          c->rfd = rfd;
Line 965 
Line 963 
 }  }
   
 void  void
 channel_prepare_select(fd_set * readset, fd_set * writeset)  channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp)
 {  {
         channel_handler(channel_pre, readset, writeset);          int n;
           u_int sz;
   
           n = MAX(*maxfdp, channel_max_fd);
   
           sz = howmany(n+1, NFDBITS) * sizeof(fd_mask);
           if (*readsetp == NULL || n > *maxfdp) {
                   if (*readsetp)
                           xfree(*readsetp);
                   if (*writesetp)
                           xfree(*writesetp);
                   *readsetp = xmalloc(sz);
                   *writesetp = xmalloc(sz);
                   *maxfdp = n;
           }
           memset(*readsetp, 0, sz);
           memset(*writesetp, 0, sz);
   
           channel_handler(channel_pre, *readsetp, *writesetp);
 }  }
   
 void  void
Line 976 
Line 992 
         channel_handler(channel_post, readset, writeset);          channel_handler(channel_post, readset, writeset);
 }  }
   
 /* If there is data to send to the connection, send some of it now. */  /* If there is data to send to the connection, enqueue some of it now. */
   
 void  void
 channel_output_poll()  channel_output_poll()
Line 1415 
Line 1431 
         for (i = 0; i < channels_alloc; i++)          for (i = 0; i < channels_alloc; i++)
                 if (channels[i].type != SSH_CHANNEL_FREE)                  if (channels[i].type != SSH_CHANNEL_FREE)
                         channel_close_fds(&channels[i]);                          channel_close_fds(&channels[i]);
 }  
   
 /* Returns the maximum file descriptor number used by the channels. */  
   
 int  
 channel_max_fd()  
 {  
         return channel_max_fd_value;  
 }  }
   
 /* Returns true if any channel is still open. */  /* Returns true if any channel is still open. */

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.84