httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: httpd-2.0/modules/ssl ssl_util.c
Date Fri, 24 Aug 2001 04:16:57 GMT
dougm       01/08/23 21:16:57

  Modified:    modules/ssl ssl_util.c
  Log:
  only set the crypto locking callback if mpm is threaded
  get rid of some warnings introduced by the original patch
  
  Revision  Changes    Path
  1.13      +27 -9     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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ssl_util.c	2001/08/24 04:08:04	1.12
  +++ ssl_util.c	2001/08/24 04:16:57	1.13
  @@ -62,6 +62,7 @@
                                     who piss me off!''
                                               -- Calvin          */
   #include "mod_ssl.h"
  +#include "ap_mpm.h"
   
   /*  _________________________________________________________________
   **
  @@ -335,7 +336,8 @@
   static apr_lock_t *lock_cs[CRYPTO_NUM_LOCKS];
   static long        lock_count[CRYPTO_NUM_LOCKS];
   
  -void ssl_util_thread_locking_callback(int mode, int type, char *file, int line)
  +static void ssl_util_thread_locking_callback(int mode, int type,
  +                                             const char *file, int line)
   {
       if (mode & CRYPTO_LOCK) {
           apr_lock_acquire(lock_cs[type]);
  @@ -346,31 +348,47 @@
       }
   }
   
  -apr_status_t ssl_util_thread_cleanup(void *data)
  +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++)
  +
  +    for (i = 0; i < CRYPTO_NUM_LOCKS; i++) {
           apr_lock_destroy(lock_cs[i]);
  +    }
  +
       return APR_SUCCESS;
   }
   
   void ssl_util_thread_setup(server_rec *s, apr_pool_t *p)
   {
  -    int i;
  +    int i, threaded_mpm;
       SSLModConfigRec *mc = myModConfig(s);
   
  +    ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm);
  +
  +    if (!threaded_mpm) {
  +        return;
  +    }
  +
       *lock_cs = apr_palloc(p, CRYPTO_NUM_LOCKS);
  -    for (i = 0; i < CRYPTO_NUM_LOCKS; i++)
  -    {
  +
  +    /*
  +     * 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;
           apr_lock_create(&(lock_cs[i]), APR_MUTEX, APR_LOCKALL,
  -                                                mc->szMutexFile, p);
  +                        mc->szMutexFile, p);
       }
  +
  +    CRYPTO_set_locking_callback(ssl_util_thread_locking_callback);
   
  -    CRYPTO_set_locking_callback((void (*)())ssl_util_thread_locking_callback);
       apr_pool_cleanup_register(p, NULL,
  -                ssl_util_thread_cleanup, apr_pool_cleanup_null);
  +                              ssl_util_thread_cleanup,
  +                              apr_pool_cleanup_null);
   
   }
  
  
  

Mime
View raw message