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

Diff for /src/usr.bin/ssh/nchan.c between version 1.17.2.4 and 1.18

version 1.17.2.4, 2001/03/21 18:52:53 version 1.18, 2000/06/20 01:39:42
Line 9 
Line 9 
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
    * 3. All advertising materials mentioning features or use of this software
    *    must display the following acknowledgement:
    *      This product includes software developed by Markus Friedl.
    * 4. The name of the author may not be used to endorse or promote products
    *    derived from this software without specific prior written permission.
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Line 25 
Line 30 
 #include "includes.h"  #include "includes.h"
 RCSID("$OpenBSD$");  RCSID("$OpenBSD$");
   
 #include "ssh1.h"  #include "ssh.h"
 #include "ssh2.h"  
 #include "buffer.h"  #include "buffer.h"
 #include "packet.h"  #include "packet.h"
 #include "channels.h"  #include "channels.h"
 #include "nchan.h"  #include "nchan.h"
   
   #include "ssh2.h"
 #include "compat.h"  #include "compat.h"
 #include "log.h"  
   
 /* functions manipulating channel states */  /* functions manipulating channel states */
 /*  /*
Line 54 
Line 60 
 static void     chan_send_close2(Channel *c);  static void     chan_send_close2(Channel *c);
 static void     chan_send_eof2(Channel *c);  static void     chan_send_eof2(Channel *c);
   
   /* channel cleanup */
   chan_event_fn *chan_delete_if_full_closed       = NULL;
   
 /* helper */  /* helper */
 static void     chan_shutdown_write(Channel *c);  static void     chan_shutdown_write(Channel *c);
 static void     chan_shutdown_read(Channel *c);  static void     chan_shutdown_read(Channel *c);
Line 246 
Line 255 
                 break;                  break;
         }          }
 }  }
   static void
   chan_delete_if_full_closed1(Channel *c)
   {
           if (c->istate == CHAN_INPUT_CLOSED && c->ostate == CHAN_OUTPUT_CLOSED) {
                   debug("channel %d: full closed", c->self);
                   channel_free(c->self);
           }
   }
   
 /*  /*
  * the same for SSH2   * the same for SSH2
Line 388 
Line 405 
                 c->flags |= CHAN_CLOSE_SENT;                  c->flags |= CHAN_CLOSE_SENT;
         }          }
 }  }
   static void
 /* shared */  chan_delete_if_full_closed2(Channel *c)
   
 int  
 chan_is_dead(Channel *c)  
 {  {
         if (c->istate != CHAN_INPUT_CLOSED || c->ostate != CHAN_OUTPUT_CLOSED)          if (c->istate == CHAN_INPUT_CLOSED && c->ostate == CHAN_OUTPUT_CLOSED) {
                 return 0;  
         if (!compat20) {  
                 debug("channel %d: is dead", c->self);  
                 return 1;  
         }  
         /*  
          * we have to delay the close message if the efd (for stderr) is  
          * still active  
          */  
         if (((c->extended_usage != CHAN_EXTENDED_IGNORE) &&  
             buffer_len(&c->extended) > 0)  
 #if 0  
             || ((c->extended_usage == CHAN_EXTENDED_READ) &&  
             c->efd != -1)  
 #endif  
             ) {  
                 debug2("channel %d: active efd: %d len %d type %s",  
                     c->self, c->efd, buffer_len(&c->extended),  
                     c->extended_usage==CHAN_EXTENDED_READ ?  
                        "read": "write");  
         } else {  
                 if (!(c->flags & CHAN_CLOSE_SENT)) {                  if (!(c->flags & CHAN_CLOSE_SENT)) {
                         chan_send_close2(c);                          chan_send_close2(c);
                 }                  }
                 if ((c->flags & CHAN_CLOSE_SENT) &&                  if ((c->flags & CHAN_CLOSE_SENT) &&
                     (c->flags & CHAN_CLOSE_RCVD)) {                      (c->flags & CHAN_CLOSE_RCVD)) {
                         debug("channel %d: is dead", c->self);                          debug("channel %d: full closed2", c->self);
                         return 1;                          channel_free(c->self);
                 }                  }
         }          }
         return 0;  
 }  }
   
   /* shared */
 void  void
 chan_init_iostates(Channel *c)  chan_init_iostates(Channel *c)
 {  {
Line 448 
Line 441 
                 chan_rcvd_ieof                  = chan_rcvd_ieof2;                  chan_rcvd_ieof                  = chan_rcvd_ieof2;
                 chan_write_failed               = chan_write_failed2;                  chan_write_failed               = chan_write_failed2;
                 chan_obuf_empty                 = chan_obuf_empty2;                  chan_obuf_empty                 = chan_obuf_empty2;
   
                   chan_delete_if_full_closed      = chan_delete_if_full_closed2;
         } else {          } else {
                 chan_rcvd_oclose                = chan_rcvd_oclose1;                  chan_rcvd_oclose                = chan_rcvd_oclose1;
                 chan_read_failed                = chan_read_failed_12;                  chan_read_failed                = chan_read_failed_12;
Line 456 
Line 451 
                 chan_rcvd_ieof                  = chan_rcvd_ieof1;                  chan_rcvd_ieof                  = chan_rcvd_ieof1;
                 chan_write_failed               = chan_write_failed1;                  chan_write_failed               = chan_write_failed1;
                 chan_obuf_empty                 = chan_obuf_empty1;                  chan_obuf_empty                 = chan_obuf_empty1;
   
                   chan_delete_if_full_closed      = chan_delete_if_full_closed1;
         }          }
 }  }
   

Legend:
Removed from v.1.17.2.4  
changed lines
  Added in v.1.18