[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.195 and 1.196

version 1.195, 2008/06/12 03:40:52 version 1.196, 2008/06/12 04:06:00
Line 166 
Line 166 
         int id, do_close;          int id, do_close;
 };  };
   
   /* Global request success/failure callbacks */
   struct global_confirm {
           TAILQ_ENTRY(global_confirm) entry;
           global_confirm_cb *cb;
           void *ctx;
           int ref_count;
   };
   TAILQ_HEAD(global_confirms, global_confirm);
   static struct global_confirms global_confirms =
       TAILQ_HEAD_INITIALIZER(global_confirms);
   
 /*XXX*/  /*XXX*/
 extern Kex *xxx_kex;  extern Kex *xxx_kex;
   
Line 460 
Line 471 
 static void  static void
 client_global_request_reply(int type, u_int32_t seq, void *ctxt)  client_global_request_reply(int type, u_int32_t seq, void *ctxt)
 {  {
           struct global_confirm *gc;
   
           if ((gc = TAILQ_FIRST(&global_confirms)) == NULL)
                   return;
           if (gc->cb != NULL)
                   gc->cb(type, seq, gc->ctx);
           if (--gc->ref_count <= 0) {
                   TAILQ_REMOVE(&global_confirms, gc, entry);
                   bzero(gc, sizeof(*gc));
                   xfree(gc);
           }
   
         keep_alive_timeouts = 0;          keep_alive_timeouts = 0;
         client_global_request_reply_fwd(type, seq, ctxt);  
 }  }
   
 static void  static void
Line 475 
Line 497 
         packet_put_cstring("keepalive@openssh.com");          packet_put_cstring("keepalive@openssh.com");
         packet_put_char(1);     /* boolean: want reply */          packet_put_char(1);     /* boolean: want reply */
         packet_send();          packet_send();
           /* Insert an empty placeholder to maintain ordering */
           client_register_global_confirm(NULL, NULL);
 }  }
   
 /*  /*
Line 692 
Line 716 
   
         channel_register_status_confirm(id, client_status_confirm,          channel_register_status_confirm(id, client_status_confirm,
             client_abandon_status_confirm, cr);              client_abandon_status_confirm, cr);
   }
   
   void
   client_register_global_confirm(global_confirm_cb *cb, void *ctx)
   {
           struct global_confirm *gc, *first_gc;
   
           /* Coalesce identical callbacks */
           first_gc = TAILQ_FIRST(&global_confirms);
           if (first_gc && first_gc->cb == cb && first_gc->ctx == ctx) {
                   if (++first_gc->ref_count >= INT_MAX)
                           fatal("%s: first_gc->ref_count = %d",
                               __func__, first_gc->ref_count);
                   return;
           }
   
           gc = xmalloc(sizeof(*gc));
           gc->cb = cb;
           gc->ctx = ctx;
           gc->ref_count = 1;
           TAILQ_INSERT_TAIL(&global_confirms, gc, entry);
 }  }
   
 static void  static void

Legend:
Removed from v.1.195  
changed lines
  Added in v.1.196