Diff for /Amaya/amaya/AHTBridge.c between versions 1.46 and 1.47

version 1.46, 1997/09/12 23:29:15 version 1.47, 1997/09/15 16:34:22
Line 62  static const SockOps ReadBits = FD_READ Line 62  static const SockOps ReadBits = FD_READ
 static const SockOps WriteBits = FD_WRITE | FD_CONNECT;  static const SockOps WriteBits = FD_WRITE | FD_CONNECT;
 static const SockOps ExceptBits = FD_OOB;  static const SockOps ExceptBits = FD_OOB;
   
 #ifdef DEBUG_PERSISTENT  
   
 #define SOCK_TABLE_SIZE 67  #define SOCK_TABLE_SIZE 67
 #define HASH(s) ((s) % SOCK_TABLE_SIZE)  #define HASH(s) ((s) % SOCK_TABLE_SIZE)
 static XtInputId persSockets[SOCK_TABLE_SIZE];  static XtInputId persSockets[SOCK_TABLE_SIZE];
   
 #endif /* DEBUG_PERSISTENT */  
   
   
 /* Private functions */  /* Private functions */
   
 /*--------------------------------------------------------------------  /*--------------------------------------------------------------------
Line 103  XtInputId          *id; Line 98  XtInputId          *id;
    HTRequest          *rqp = NULL;     HTRequest          *rqp = NULL;
    AHTReqContext      *me;     AHTReqContext      *me;
    SockOps             ops;          SockOps             ops;     
 #ifdef DEBUG_PERSISTENT  
    int                 v;     int                 v;
 #endif /* DEBUG_PERSISTENT */  
    int                 socket = *s;     int                 socket = *s;
    HTEventCallback    *cbf;     HTEventCallback    *cbf;
   
    /* Libwww 5.0a does not take into account the ops parameter     /* Libwww 5.0a does not take into account the ops parameter
       in the invocation of for this function call */        in the invocation of for this function call */
      
    ops = FD_WRITE;     ops = FD_WRITE;
    cbf = (HTEventCallback *) __RetrieveCBF (socket, ops, &rqp);     cbf = (HTEventCallback *) __RetrieveCBF (socket, ops, &rqp);
      
      v = HASH (socket);
      if (persSockets[v]) 
        {
          persSockets[v] = 0;
          /* we're not sure what can be the value of rqp */
          rqp = NULL;
        }
      
    /* if rqp is NULL, we are dealing with a persistent socket shutdown */     /* if rqp is NULL, we are dealing with a persistent socket shutdown */
    if (!(cbf) || !(rqp) || rqp->priority == HT_PRIORITY_OFF)      if (!(cbf) || !(rqp) || rqp->priority == HT_PRIORITY_OFF) 
      {       {
 #ifdef DEBUG_LIBWWW  
        HTTrace ("Callback.... No callback found\n");  
 #endif  
        /* remove the Xt input which caused this callback */  
 #     ifdef WWW_XWINDOWS  
        XtRemoveInput (*id);  
 #     endif  
          
        /* if it's a persistent socket, remove it from the table */  
   
        if (cbf)         if (cbf)
          (*cbf) (socket, 0, FD_CLOSE);           (*cbf) (socket, 0, FD_READ);
          
 #if DEBUG_PERSISTENT  
        v = HASH (socket);  
        if (persSockets[v])   
          {  
            persSockets[v] = 0;  
            if (cbf)  
              (*cbf) (socket, 0, FD_CLOSE);  
          }  
   
 #endif /* DEBUG_PERSISTENT */  
   
      /* remove the Xt input which caused this callback */
   #  ifdef WWW_XWINDOWS
          XtRemoveInput (*id);
   #  endif
        return (0);         return (0);
      }       }
         
Line 486  HTPriority          p; Line 470  HTPriority          p;
   AHTReqContext      *me;      /* current request */    AHTReqContext      *me;      /* current request */
   int                 status;  /* libwww status associated with     int                 status;  /* libwww status associated with 
                                   the socket number */                                    the socket number */
 #ifdef DEBUG_PERSISTENT  
   int                 v;    int                 v;
 #endif /* DEBUG_PERSISTENT */  
   
 #ifdef DEBUG_LIBWWW  #ifdef DEBUG_LIBWWW
           fprintf(stderr, "HTEvent_register\n");            fprintf(stderr, "HTEvent_register\n");
Line 496  HTPriority          p; Line 478  HTPriority          p;
   if (sock == INVSOC)    if (sock == INVSOC)
     return (0);      return (0);
   
   
   /* get the request associated to the socket number */    /* get the request associated to the socket number */
   
   if (rqp == NULL)   #ifndef _WINDOWS
     v = HASH (sock);
     if (persSockets[v] != 0)
     {      {
         XtRemoveInput (persSockets[v]);
         persSockets[v] = 0;      
       }
   #endif
   
     if (rqp == NULL) 
       {
 #ifndef _WINDOWS   #ifndef _WINDOWS 
       if (ops == FD_CLOSE)        if (ops == FD_CLOSE)
         {          {
Line 511  HTPriority          p; Line 498  HTPriority          p;
           fprintf(stderr, "HTEvent_register: ***** RQP is NULL @@@@@\n");            fprintf(stderr, "HTEvent_register: ***** RQP is NULL @@@@@\n");
 #endif /* DEBUG_LIBWWW */  #endif /* DEBUG_LIBWWW */
   
 #if DEBUG_PERSISTENT  
           v = HASH (sock);  
           if (persSockets[v] != 0)   
             {  
               XtRemoveInput (persSockets[v]);  
             }  
   
           persSockets[v] = XtAppAddInput (app_cont,             persSockets[v] = XtAppAddInput (app_cont, 
                                           sock,                                            sock,
                                           (XtPointer) XtInputReadMask,                                            (XtPointer) XtInputReadMask,
                                           (XtInputCallbackProc) AHTCallback_bridge,                                            (XtInputCallbackProc) AHTCallback_bridge,
                                           (XtPointer) XtInputReadMask);                                            (XtPointer) XtInputReadMask);
 #endif /* DEBUG_PERSISTENT */  
   
           XtAppAddInput (app_cont,   
                          sock,  
                          (XtPointer) XtInputReadMask,  
                          (XtInputCallbackProc) AHTCallback_bridge,  
                          (XtPointer) XtInputReadMask);  
         } /* *fd_close */          } /* *fd_close */
   
   
   
 #endif /* !_WINDOWS */  #endif /* !_WINDOWS */
     }      }
   else /* rqp */    else /* rqp */
     {      {
       me = HTRequest_context (rqp);        me = HTRequest_context (rqp);
         
 #if DEBUG_PERSISTENT        /* Erase any trailing events */
   
          
 #ifndef _WINDOWS  
       v = HASH (sock);  
       if (persSockets[v] != 0) {  
         XtRemoveInput (persSockets[v]);  
         persSockets[v] = 0;  
       }     
   
 #endif /* DEBUG_PERSISTENT */  
   
 #endif /* _WINDOWS */  
           /* Erase any trailing events */  
       /*          HTEventrg_unregister (sock, FD_ALL); */        /*          HTEventrg_unregister (sock, FD_ALL); */
         
 #ifndef _WINDOWS  #ifndef _WINDOWS
        if (ops & ReadBits)         if (ops & ReadBits)
          {           {
Line 610  SockOps             ops; Line 568  SockOps             ops;
    AHTReqContext      *me;     AHTReqContext      *me;
 #endif /* _WINDOWS */  #endif /* _WINDOWS */
   
 #ifdef DEBUG_PERSISTENT  
    int                 v;     int                 v;
 #endif /* DEBUG_PERSISTENT */  
   
   
    /* Libwww 5.0a does not take into account the third parameter     /* Libwww 5.0a does not take into account the third parameter
       **  for this function call */        **  for this function call */
Line 630  SockOps             ops; Line 585  SockOps             ops;
    fprintf (stderr, "AHTEventUnregister: cbf = %d, sock = %d, rqp = %d, ops= %x", cbf, sock, rqp, ops);     fprintf (stderr, "AHTEventUnregister: cbf = %d, sock = %d, rqp = %d, ops= %x", cbf, sock, rqp, ops);
 #endif /* DEBUG_LIBWWW */  #endif /* DEBUG_LIBWWW */
   
 #if DEBUG_PERSISTENT  
   
    v = HASH (sock);     v = HASH (sock);
    if (persSockets[v] != 0) {     if (persSockets[v] != 0) 
      XtRemoveInput (persSockets[v]);       {
      persSockets[v] = 0;         XtRemoveInput (persSockets[v]);
    }         persSockets[v] = 0;
        }
 #endif /* DEBUG_PERSISTENT */  
   
    if (cbf)     if (cbf)
      {       {

Removed from v.1.46  
changed lines
  Added in v.1.47


Webmaster