[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.15 and 1.16

version 1.15, 1999/10/16 21:19:00 version 1.16, 1999/10/17 16:56:08
Line 136 
Line 136 
         buffer_init(&channels[i].output);          buffer_init(&channels[i].output);
         channels[i].self = i;          channels[i].self = i;
         channels[i].type = type;          channels[i].type = type;
           channels[i].x11 = 0;
         channels[i].sock = sock;          channels[i].sock = sock;
         channels[i].flags = 0;  
         channels[i].remote_id = -1;          channels[i].remote_id = -1;
         channels[i].remote_name = remote_name;          channels[i].remote_name = remote_name;
           chan_init_iostates(&channels[i]);
         return i;          return i;
       }        }
   
Line 156 
Line 157 
   buffer_init(&channels[old_channels].output);    buffer_init(&channels[old_channels].output);
   channels[old_channels].self = old_channels;    channels[old_channels].self = old_channels;
   channels[old_channels].type = type;    channels[old_channels].type = type;
     channels[old_channels].x11 = 0;
   channels[old_channels].sock = sock;    channels[old_channels].sock = sock;
   channels[old_channels].flags = 0;  
   channels[old_channels].remote_id = -1;    channels[old_channels].remote_id = -1;
   channels[old_channels].remote_name = remote_name;    channels[old_channels].remote_name = remote_name;
     chan_init_iostates(&channels[old_channels]);
   return old_channels;    return old_channels;
 }  }
   
Line 213 
Line 215 
             break;              break;
           }            }
           /* test whether sockets are 'alive' for read/write */            /* test whether sockets are 'alive' for read/write */
           if (!(ch->flags & CHAN_SHUT_RD))            if (ch->istate == CHAN_INPUT_OPEN)
             if (buffer_len(&ch->input) < 32768)              if (buffer_len(&ch->input) < 32768)
               FD_SET(ch->sock, readset);                FD_SET(ch->sock, readset);
           if (!(ch->flags & CHAN_SHUT_WR)){            if (ch->ostate == CHAN_OUTPUT_OPEN || ch->ostate == CHAN_OUTPUT_WAIT_DRAIN){
             if (buffer_len(&ch->output) > 0){              if (buffer_len(&ch->output) > 0){
               FD_SET(ch->sock, writeset);                FD_SET(ch->sock, writeset);
             }else if(ch->flags & CHAN_IEOF_RCVD){              }else if(ch->ostate == CHAN_OUTPUT_WAIT_DRAIN) {
               /* if output-buffer empty AND IEOF received,                chan_obuf_empty(ch);
                  we won't get more data for writing */  
               chan_shutdown_write(ch);  
               chan_send_oclose(ch);  
             }              }
           }            }
           break;            break;
Line 319 
Line 318 
   
           /* Start normal processing for the channel. */            /* Start normal processing for the channel. */
           ch->type = SSH_CHANNEL_OPEN;            ch->type = SSH_CHANNEL_OPEN;
             /* Enable X11 Problem FIX */
             ch->x11 = 1;
           goto redo;            goto redo;
   
         reject:          reject:
Line 335 
Line 336 
             packet_put_int(ch->remote_id);              packet_put_int(ch->remote_id);
             packet_send();              packet_send();
           }else{            }else{
             chan_shutdown_read(ch);     /* shutdown, since close() does not update ch->flags */              debug("X11 rejected %d 0x%x 0x%x", ch->self, ch->istate, ch->ostate);
             chan_send_ieof(ch);         /* no need to wait for output-buffer */              chan_read_failed(ch);
             chan_shutdown_write(ch);              chan_write_failed(ch);
             chan_send_oclose(ch);              debug("X11 rejected %d 0x%x 0x%x", ch->self, ch->istate, ch->ostate);
           }            }
           break;            break;
   
Line 461 
Line 462 
                     ch->type = SSH_CHANNEL_INPUT_DRAINING;                      ch->type = SSH_CHANNEL_INPUT_DRAINING;
                     debug("Channel %d status set to input draining.", i);                      debug("Channel %d status set to input draining.", i);
                   }else{                    }else{
                     buffer_consume(&ch->output, buffer_len(&ch->output));                      chan_read_failed(ch);
                     chan_shutdown_read(ch);  
                     /* we have to wait until the input-buffer has been  
                        sent to our peer before we can send IEOF */  
                   }                    }
                   break;                    break;
                 }                  }
Line 482 
Line 480 
                     debug("Channel %d status set to input draining.", i);                      debug("Channel %d status set to input draining.", i);
                     ch->type = SSH_CHANNEL_INPUT_DRAINING;                      ch->type = SSH_CHANNEL_INPUT_DRAINING;
                   }else{                    }else{
                     buffer_consume(&ch->output, buffer_len(&ch->output));                      chan_write_failed(ch);
                     chan_shutdown_write(ch);  
                     chan_send_oclose(ch);  
                   }                    }
                   break;                    break;
                 }                  }
               buffer_consume(&ch->output, len);                buffer_consume(&ch->output, len);
             }              }
           chan_del_if_dead(ch);  
           break;            break;
   
         case SSH_CHANNEL_OUTPUT_DRAINING:          case SSH_CHANNEL_OUTPUT_DRAINING:
Line 553 
Line 548 
           packet_send();            packet_send();
           buffer_consume(&ch->input, len);            buffer_consume(&ch->input, len);
         }          }
       else if(ch->flags & CHAN_SHUT_RD)        else if(ch->istate == CHAN_INPUT_WAIT_DRAIN)
         {          {
           if (compat13)            if (compat13)
              fatal("cannot happen: CHAN_SHUT_RD set for proto 1.3");               fatal("cannot happen: istate == INPUT_WAIT_DRAIN for proto 1.3");
           /* input-buffer is empty and read-socket shutdown:            /* input-buffer is empty and read-socket shutdown:
              tell peer, that we will not send more data: send IEOF */               tell peer, that we will not send more data: send IEOF */
           chan_send_ieof(ch);            chan_ibuf_empty(ch);
         }          }
     }      }
 }  }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16