Changeset c34a68b in mod_gnutls


Ignore:
Timestamp:
Apr 19, 2018, 2:50:49 PM (3 years ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, debian/master, master, proxy-ticket
Children:
a85de63
Parents:
3656df0
Message:

dbm_cache_fetch: Prepare for signature without connection context

Minimizing references to the connection context and collecting them
all at the top will make the signature change easier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_cache.c

    r3656df0 rc34a68b  
    456456static gnutls_datum_t dbm_cache_fetch(mgs_handle_t *ctxt, gnutls_datum_t key)
    457457{
     458    server_rec *server = ctxt->c->base_server;
     459    apr_pool_t *pool = ctxt->c->pool;
     460    mgs_srvconf_rec *sc = (mgs_srvconf_rec *)
     461        ap_get_module_config(server->module_config, &gnutls_module);
     462
    458463    gnutls_datum_t data = {NULL, 0};
    459464    apr_dbm_t *dbm;
     
    464469
    465470    /* check if it is time for cache expiration */
    466     dbm_cache_expire(ctxt->c->base_server);
    467 
    468     apr_global_mutex_lock(ctxt->sc->cache->mutex);
    469 
    470     rv = apr_dbm_open_ex(&dbm, db_type(ctxt->sc),
    471             ctxt->sc->cache_config, APR_DBM_READONLY,
    472             SSL_DBM_FILE_MODE, ctxt->c->pool);
     471    dbm_cache_expire(server);
     472
     473    apr_global_mutex_lock(sc->cache->mutex);
     474
     475    rv = apr_dbm_open_ex(&dbm, db_type(sc),
     476                         sc->cache_config, APR_DBM_READONLY,
     477                         SSL_DBM_FILE_MODE, pool);
    473478    if (rv != APR_SUCCESS) {
    474         ap_log_cerror(APLOG_MARK, APLOG_NOTICE, rv, ctxt->c,
    475                       "error opening cache '%s'",
    476                       ctxt->sc->cache_config);
    477         apr_global_mutex_unlock(ctxt->sc->cache->mutex);
     479        ap_log_error(APLOG_MARK, APLOG_NOTICE, rv, server,
     480                     "error opening cache '%s'",
     481                     sc->cache_config);
     482        apr_global_mutex_unlock(sc->cache->mutex);
    478483        return data;
    479484    }
     
    498503    }
    499504
    500     ap_log_cerror(APLOG_MARK, APLOG_TRACE1, rv, ctxt->c,
    501                   "fetched %" APR_SIZE_T_FMT " bytes from cache",
    502                   dbmval.dsize);
     505    ap_log_error(APLOG_MARK, APLOG_TRACE1, rv, server,
     506                 "fetched %" APR_SIZE_T_FMT " bytes from cache",
     507                 dbmval.dsize);
    503508
    504509    memcpy(data.data, dbmval.dptr + sizeof (apr_time_t), data.size);
     
    508513 close_db:
    509514    apr_dbm_close(dbm);
    510     apr_global_mutex_unlock(ctxt->sc->cache->mutex);
     515    apr_global_mutex_unlock(sc->cache->mutex);
    511516
    512517    /* cache entry might have expired since last cache cleanup */
     
    516521        data.data = NULL;
    517522        data.size = 0;
    518         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, APR_SUCCESS, ctxt->c,
    519                       "dropped expired cache data");
     523        ap_log_error(APLOG_MARK, APLOG_TRACE1, APR_SUCCESS, server,
     524                     "dropped expired cache data");
    520525    }
    521526
Note: See TracChangeset for help on using the changeset viewer.