manoj       99/10/13 15:40:10

  Modified:    src/include mpm_status.h
               src/modules/mpm/dexter scoreboard.c
  Log:
  Add calls ap_get_connections and ap_get_connection_keys to the
  connection status API, and add implementations of these calls to Dexter.
  
  Revision  Changes    Path
  1.2       +15 -0     apache-2.0/src/include/mpm_status.h
  
  Index: mpm_status.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/mpm_status.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -d -u -r1.1 -r1.2
  --- mpm_status.h      1999/10/13 05:24:12     1.1
  +++ mpm_status.h      1999/10/13 22:40:09     1.2
  @@ -81,6 +81,21 @@
   API_EXPORT(const char *) ap_get_connection_status(long conn_id, const char 
*key);
   
   /**
  + * Get an array of current connection IDs.
  + *
  + */
  +API_EXPORT(ap_array_header_t *) ap_get_connections(ap_context_t *p);
  +
  +/**
  + * Get an array of keys from a given connection.
  + *
  + * conn_id = Connection ID
  + *
  + */
  +API_EXPORT(ap_array_header_t *) ap_get_connection_keys(ap_context_t *p,
  +                                                       long conn_id);
  +
  +/**
    *
    * Set a cell in the status table. No guarantees are made that long strings
    * won't be truncated.
  
  
  
  1.6       +39 -0     apache-2.0/src/modules/mpm/dexter/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/scoreboard.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -d -u -r1.5 -r1.6
  --- scoreboard.c      1999/10/13 22:35:40     1.5
  +++ scoreboard.c      1999/10/13 22:40:09     1.6
  @@ -483,6 +483,45 @@
       return NULL;
   }
   
  +ap_array_header_t *ap_get_connections(ap_context_t *p)
  +{
  +    int i;
  +    ap_array_header_t *connection_list;
  +    long *array_slot;
  +
  +    connection_list = ap_make_array(p, 0, sizeof(long));
  +    /* We assume that there is a connection iff it has an entry in the status
  +     * table. Connections without any status sound problematic to me, so this
  +     * is probably for the best. - manoj */
  +    for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) {
  +     if (ap_scoreboard_image->table[i][0].key[0] != '\0') {
  +            array_slot = ap_push_array(connection_list);
  +            *array_slot = i;
  +        }
  +    }
  +    return connection_list;
  +}
  +
  +ap_array_header_t *ap_get_connection_keys(ap_context_t *p, long conn_id)
  +{
  +    int i = 0;
  +    status_table_entry *ss;
  +    ap_array_header_t *key_list;
  +    char **array_slot;
  +
  +    key_list = ap_make_array(p, 0, KEY_LENGTH * sizeof(char));
  +    while (i < STATUSES_PER_CONNECTION) {
  +        ss = &(ap_scoreboard_image->table[conn_id][i]);
  +        if (ss->key[0] == '\0') {
  +            break;
  +        }
  +        array_slot = ap_push_array(key_list);
  +        *array_slot = ap_pstrdup(p, ss->key);
  +        i++;
  +    }
  +    return key_list;
  +}
  +
   /* Note: no effort is made here to prevent multiple threads from messing with
    * a single connection at the same time. ap_update_connection_status should
    * only be called by the thread that owns the connection */
  
  
  

Reply via email to