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

Diff for /src/usr.bin/ssh/packet.c between version 1.55 and 1.56

version 1.55, 2001/03/01 02:45:10 version 1.56, 2001/03/03 21:41:07
Line 660 
Line 660 
 packet_read(int *payload_len_ptr)  packet_read(int *payload_len_ptr)
 {  {
         int type, len;          int type, len;
         fd_set set;          fd_set *setp;
         char buf[8192];          char buf[8192];
         DBG(debug("packet_read()"));          DBG(debug("packet_read()"));
   
           setp = (fd_set *)xmalloc(howmany(connection_in+1, NFDBITS) *
               sizeof(fd_mask));
   
         /* Since we are blocking, ensure that all written packets have been sent. */          /* Since we are blocking, ensure that all written packets have been sent. */
         packet_write_wait();          packet_write_wait();
   
Line 678 
Line 681 
                     || type == SSH_CMSG_EXIT_CONFIRMATION))                      || type == SSH_CMSG_EXIT_CONFIRMATION))
                         packet_integrity_check(*payload_len_ptr, 0, type);                          packet_integrity_check(*payload_len_ptr, 0, type);
                 /* If we got a packet, return it. */                  /* If we got a packet, return it. */
                 if (type != SSH_MSG_NONE)                  if (type != SSH_MSG_NONE) {
                           xfree(setp);
                         return type;                          return type;
                   }
                 /*                  /*
                  * Otherwise, wait for some data to arrive, add it to the                   * Otherwise, wait for some data to arrive, add it to the
                  * buffer, and try again.                   * buffer, and try again.
                  */                   */
                 FD_ZERO(&set);                  memset(setp, 0, howmany(connection_in + 1, NFDBITS) *
                 FD_SET(connection_in, &set);                      sizeof(fd_mask));
                   FD_SET(connection_in, setp);
   
                 /* Wait for some data to arrive. */                  /* Wait for some data to arrive. */
                 while (select(connection_in + 1, &set, NULL, NULL, NULL) == -1 &&                  while (select(connection_in + 1, setp, NULL, NULL, NULL) == -1 &&
                     (errno == EAGAIN || errno == EINTR))                      (errno == EAGAIN || errno == EINTR))
                         ;                          ;
   
Line 1194 
Line 1200 
 void  void
 packet_write_wait()  packet_write_wait()
 {  {
           fd_set *setp;
   
           setp = (fd_set *)xmalloc(howmany(connection_out + 1, NFDBITS) *
               sizeof(fd_mask));
         packet_write_poll();          packet_write_poll();
         while (packet_have_data_to_write()) {          while (packet_have_data_to_write()) {
                 fd_set set;                  memset(setp, 0, howmany(connection_out + 1, NFDBITS) *
                       sizeof(fd_mask));
                 FD_ZERO(&set);                  FD_SET(connection_out, setp);
                 FD_SET(connection_out, &set);                  while (select(connection_out + 1, NULL, setp, NULL, NULL) == -1 &&
                 while (select(connection_out + 1, NULL, &set, NULL, NULL) == -1 &&  
                     (errno == EAGAIN || errno == EINTR))                      (errno == EAGAIN || errno == EINTR))
                         ;                          ;
                 packet_write_poll();                  packet_write_poll();
         }          }
           xfree(setp);
 }  }
   
 /* Returns true if there is buffered data to write to the connection. */  /* Returns true if there is buffered data to write to the connection. */

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.56