Changeset aa68232 in mod_gnutls
- Timestamp:
- Jun 10, 2016, 4:16:48 AM (6 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, master, proxy-ticket, upstream
- Children:
- d6834e0
- Parents:
- e809fb30
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
include/mod_gnutls.h.in
re809fb30 raa68232 136 136 mgs_cache_e cache_type; 137 137 const char* cache_config; 138 /* Mutex for cache access (used only if the cache type is not139 * thread-safe) */140 apr_global_mutex_t *cache_mutex;141 138 /* Internal cache data */ 142 139 mgs_cache_t cache; -
src/gnutls_cache.c
re809fb30 raa68232 389 389 deleted = 0; 390 390 391 apr_global_mutex_lock(sc->cache _mutex);391 apr_global_mutex_lock(sc->cache->mutex); 392 392 393 393 rv = apr_dbm_open_ex(&dbm, db_type(sc), … … 398 398 "[gnutls_cache] error opening cache '%s'", 399 399 sc->cache_config); 400 apr_global_mutex_unlock(sc->cache _mutex);400 apr_global_mutex_unlock(sc->cache->mutex); 401 401 apr_pool_destroy(spool); 402 402 return; … … 424 424 apr_dbm_close(dbm); 425 425 426 rv = apr_global_mutex_unlock(sc->cache _mutex);426 rv = apr_global_mutex_unlock(sc->cache->mutex); 427 427 428 428 ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s, … … 447 447 dbm_cache_expire(ctxt->c->base_server); 448 448 449 apr_global_mutex_lock(ctxt->sc->cache _mutex);449 apr_global_mutex_lock(ctxt->sc->cache->mutex); 450 450 451 451 rv = apr_dbm_open_ex(&dbm, db_type(ctxt->sc), … … 456 456 "error opening cache '%s'", 457 457 ctxt->sc->cache_config); 458 apr_global_mutex_unlock(ctxt->sc->cache _mutex);458 apr_global_mutex_unlock(ctxt->sc->cache->mutex); 459 459 return data; 460 460 } … … 486 486 close_db: 487 487 apr_dbm_close(dbm); 488 apr_global_mutex_unlock(ctxt->sc->cache _mutex);488 apr_global_mutex_unlock(ctxt->sc->cache->mutex); 489 489 490 490 /* cache entry might have expired since last cache cleanup */ … … 539 539 data.data, data.size); 540 540 541 apr_global_mutex_lock(sc->cache _mutex);541 apr_global_mutex_lock(sc->cache->mutex); 542 542 543 543 rv = apr_dbm_open_ex(&dbm, db_type(sc), … … 549 549 "error opening cache '%s'", 550 550 sc->cache_config); 551 apr_global_mutex_unlock(sc->cache _mutex);551 apr_global_mutex_unlock(sc->cache->mutex); 552 552 apr_pool_destroy(spool); 553 553 return -1; … … 561 561 sc->cache_config); 562 562 apr_dbm_close(dbm); 563 apr_global_mutex_unlock(sc->cache _mutex);563 apr_global_mutex_unlock(sc->cache->mutex); 564 564 apr_pool_destroy(spool); 565 565 return -1; … … 567 567 568 568 apr_dbm_close(dbm); 569 apr_global_mutex_unlock(sc->cache _mutex);569 apr_global_mutex_unlock(sc->cache->mutex); 570 570 571 571 ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s, … … 603 603 apr_datum_t dbmkey = {(char*) tmpkey.data, tmpkey.size}; 604 604 605 apr_global_mutex_lock(ctxt->sc->cache _mutex);605 apr_global_mutex_lock(ctxt->sc->cache->mutex); 606 606 607 607 rv = apr_dbm_open_ex(&dbm, db_type(ctxt->sc), … … 613 613 "[gnutls_cache] error opening cache '%s'", 614 614 ctxt->sc->cache_config); 615 apr_global_mutex_unlock(ctxt->sc->cache _mutex);615 apr_global_mutex_unlock(ctxt->sc->cache->mutex); 616 616 return -1; 617 617 } … … 625 625 ctxt->sc->cache_config); 626 626 apr_dbm_close(dbm); 627 apr_global_mutex_unlock(ctxt->sc->cache _mutex);627 apr_global_mutex_unlock(ctxt->sc->cache->mutex); 628 628 return -1; 629 629 } 630 630 631 631 apr_dbm_close(dbm); 632 apr_global_mutex_unlock(ctxt->sc->cache _mutex);632 apr_global_mutex_unlock(ctxt->sc->cache->mutex); 633 633 634 634 return 0; … … 688 688 689 689 /* initialize mutex only once */ 690 if (sc->cache_mutex == NULL) 691 { 692 apr_status_t rv = ap_global_mutex_create(&sc->cache_mutex, NULL, 690 if (sc->cache == NULL) 691 { 692 sc->cache = apr_palloc(p, sizeof(struct mgs_cache)); 693 apr_status_t rv = ap_global_mutex_create(&sc->cache->mutex, NULL, 693 694 MGS_CACHE_MUTEX_NAME, 694 695 NULL, s, p, 0); … … 697 698 } 698 699 699 sc->cache = apr_palloc(p, sizeof(struct mgs_cache));700 700 if (sc->cache_type == mgs_cache_dbm || sc->cache_type == mgs_cache_gdbm) 701 701 { … … 715 715 } 716 716 717 #if HAVE_APR_MEMCACHE718 717 int mgs_cache_child_init(apr_pool_t * p, 719 718 server_rec * s, 720 719 mgs_srvconf_rec * sc) 721 #else 722 int mgs_cache_child_init(apr_pool_t * p __attribute__((unused)), 723 server_rec * s __attribute__((unused)), 724 mgs_srvconf_rec * sc) 725 #endif 726 { 720 { 721 /* reinit cache mutex */ 722 const char *lockfile = apr_global_mutex_lockfile(sc->cache->mutex); 723 apr_status_t rv = apr_global_mutex_child_init(&sc->cache->mutex, 724 lockfile, p); 725 if (rv != APR_SUCCESS) 726 ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, 727 "Failed to reinit mutex '%s'", MGS_CACHE_MUTEX_NAME); 728 727 729 if (sc->cache_type == mgs_cache_dbm 728 730 || sc->cache_type == mgs_cache_gdbm) { -
src/gnutls_cache.h
re809fb30 raa68232 61 61 cache_store_func store; 62 62 cache_fetch_func fetch; 63 /* Mutex for cache access (used only if the cache type is not 64 * thread-safe) */ 65 apr_global_mutex_t *mutex; 63 66 }; 64 67 -
src/gnutls_config.c
re809fb30 raa68232 964 964 sc->cache_type = mgs_cache_unset; 965 965 sc->cache_config = NULL; 966 sc->cache_mutex = NULL;967 966 sc->cache = NULL; 968 967 sc->tickets = GNUTLS_ENABLED_UNSET; -
src/gnutls_hooks.c
re809fb30 raa68232 375 375 sc->cache_config = sc_base->cache_config; 376 376 sc->cache_timeout = sc_base->cache_timeout; 377 sc->cache_mutex = sc_base->cache_mutex;378 377 sc->cache = sc_base->cache; 379 378 … … 522 521 "GnuTLS: Failed to run Cache Init"); 523 522 } 524 }525 526 /* reinit cache mutex */527 if (sc->cache_mutex != NULL)528 {529 const char *lockfile = apr_global_mutex_lockfile(sc->cache_mutex);530 rv = apr_global_mutex_child_init(&sc->cache_mutex, lockfile, p);531 if (rv != APR_SUCCESS)532 ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,533 "Failed to reinit mutex '%s'", MGS_CACHE_MUTEX_NAME);534 523 } 535 524
Note: See TracChangeset
for help on using the changeset viewer.