httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/ssl mod_ssl.h ssl_util.c ssl_engine_init.c
Date Tue, 04 Jun 2002 02:19:33 GMT
wrowe       2002/06/03 19:19:33

  Modified:    modules/ssl mod_ssl.h ssl_util.c ssl_engine_init.c
  Log:
    The only remaining question ... are nested or strictly unnested locks
    expected by OpenSSL?  Right now I've left it as _DEFAULT for the platform
    preference.  Very simple code really - the server_rec was superfluous.
  
  Revision  Changes    Path
  1.118     +1 -1      httpd-2.0/modules/ssl/mod_ssl.h
  
  Index: mod_ssl.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/mod_ssl.h,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- mod_ssl.h	16 May 2002 06:09:13 -0000	1.117
  +++ mod_ssl.h	4 Jun 2002 02:19:32 -0000	1.118
  @@ -720,7 +720,7 @@
   ssl_algo_t   ssl_util_algotypeof(X509 *, EVP_PKEY *); 
   char        *ssl_util_algotypestr(ssl_algo_t);
   char        *ssl_util_ptxtsub(apr_pool_t *, const char *, const char *, char *);
  -void         ssl_util_thread_setup(server_rec *, apr_pool_t *);
  +void         ssl_util_thread_setup(apr_pool_t *);
   
   #define APR_SHM_MAXSIZE (64 * 1024 * 1024)
   #endif /* __MOD_SSL_H__ */
  
  
  
  1.33      +18 -42    httpd-2.0/modules/ssl/ssl_util.c
  
  Index: ssl_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/ssl_util.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ssl_util.c	9 May 2002 10:53:28 -0000	1.32
  +++ ssl_util.c	4 Jun 2002 02:19:33 -0000	1.33
  @@ -400,20 +400,18 @@
    */
   
   static apr_thread_mutex_t **lock_cs;
  -/* FIXME: CRYPTO_NUM_LOCKS may vary between releases - replace with
  -   CRYPT_num_locks() [Ben, Jan 2002] */
  -static long                 lock_count[CRYPTO_NUM_LOCKS];
  +static int                  lock_num_locks;
   
   static void ssl_util_thr_lock(int mode, int type,
  -                              MODSSL_CRYPTO_CB_ARG_TYPE *file,
  -                              int line)
  +                              const char *file, int line)
   {
  -    if (mode & CRYPTO_LOCK) {
  -        apr_thread_mutex_lock(lock_cs[type]);
  -        lock_count[type]++;
  -    }
  -    else {
  -        apr_thread_mutex_unlock(lock_cs[type]);
  +    if (type < lock_num_locks) {
  +        if (mode & CRYPTO_LOCK) {
  +            apr_thread_mutex_lock(lock_cs[type]);
  +        }
  +        else {
  +            apr_thread_mutex_unlock(lock_cs[type]);
  +        }
       }
   }
   
  @@ -437,41 +435,21 @@
   
   static apr_status_t ssl_util_thread_cleanup(void *data)
   {
  -    int i;
  -
       CRYPTO_set_locking_callback(NULL);
   
  -    for (i = 0; i < CRYPTO_NUM_LOCKS; i++) {
  -        apr_thread_mutex_destroy(lock_cs[i]);
  -    }
  -
  +    /* Let the registered mutex cleanups do their own thing 
  +     */
       return APR_SUCCESS;
   }
   
  -void ssl_util_thread_setup(server_rec *s, apr_pool_t *p)
  +void ssl_util_thread_setup(apr_pool_t *p)
   {
  -    int i, threaded_mpm;
  -    /* This variable is not used? -aaron
  -    SSLModConfigRec *mc = myModConfig(s);
  -    */
  -
  -    ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm);
  -
  -    if (!threaded_mpm) {
  -        return;
  -    }
  +    int i;
   
  -    lock_cs = apr_palloc(p, CRYPTO_NUM_LOCKS * sizeof(apr_thread_mutex_t *));
  +    lock_num_locks = CRYPTO_num_locks();
  +    lock_cs = apr_palloc(p, lock_num_locks * sizeof(*lock_cs));
   
  -    /*
  -     * XXX: CRYPTO_NUM_LOCKS == 28
  -     * should determine if there are lock types we do not need
  -     * for example: debug_malloc, debug_malloc2 (see crypto/cryptlib.c)
  -     */
  -    for (i = 0; i < CRYPTO_NUM_LOCKS; i++) {
  -        lock_count[i] = 0;
  -        /* XXX: Can we remove the lock_count now that apr_thread_mutex_t
  -         * can support nested (aka recursive) locks? -aaron */
  +    for (i = 0; i < lock_num_locks; i++) {
           apr_thread_mutex_create(&(lock_cs[i]), APR_THREAD_MUTEX_DEFAULT, p);
       }
   
  @@ -479,9 +457,7 @@
   
       CRYPTO_set_locking_callback(ssl_util_thr_lock);
   
  -    apr_pool_cleanup_register(p, NULL,
  -                              ssl_util_thread_cleanup,
  -                              apr_pool_cleanup_null);
  -
  +    apr_pool_cleanup_register(p, NULL, ssl_util_thread_cleanup,
  +                                       apr_pool_cleanup_null);
   }
   #endif
  
  
  
  1.100     +1 -1      httpd-2.0/modules/ssl/ssl_engine_init.c
  
  Index: ssl_engine_init.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/ssl_engine_init.c,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- ssl_engine_init.c	17 May 2002 18:21:12 -0000	1.99
  +++ ssl_engine_init.c	4 Jun 2002 02:19:33 -0000	1.100
  @@ -260,7 +260,7 @@
       ssl_init_SSLLibrary(base_server);
   
   #if APR_HAS_THREADS
  -    ssl_util_thread_setup(base_server, p);
  +    ssl_util_thread_setup(p);
   #endif
   
       /*
  
  
  

Mime
View raw message