Lines Matching refs:cache
46 void mbedtls_ssl_cache_init( mbedtls_ssl_cache_context *cache ) in mbedtls_ssl_cache_init() argument
48 memset( cache, 0, sizeof( mbedtls_ssl_cache_context ) ); in mbedtls_ssl_cache_init()
50 cache->timeout = MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT; in mbedtls_ssl_cache_init()
51 cache->max_entries = MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES; in mbedtls_ssl_cache_init()
54 mbedtls_mutex_init( &cache->mutex ); in mbedtls_ssl_cache_init()
64 mbedtls_ssl_cache_context *cache = (mbedtls_ssl_cache_context *) data; in mbedtls_ssl_cache_get() local
68 if( mbedtls_mutex_lock( &cache->mutex ) != 0 ) in mbedtls_ssl_cache_get()
72 cur = cache->chain; in mbedtls_ssl_cache_get()
81 if( cache->timeout != 0 && in mbedtls_ssl_cache_get()
82 (int) ( t - entry->timestamp ) > cache->timeout ) in mbedtls_ssl_cache_get()
130 if( mbedtls_mutex_unlock( &cache->mutex ) != 0 ) in mbedtls_ssl_cache_get()
144 mbedtls_ssl_cache_context *cache = (mbedtls_ssl_cache_context *) data; in mbedtls_ssl_cache_set() local
149 if( ( ret = mbedtls_mutex_lock( &cache->mutex ) ) != 0 ) in mbedtls_ssl_cache_set()
153 cur = cache->chain; in mbedtls_ssl_cache_set()
161 if( cache->timeout != 0 && in mbedtls_ssl_cache_set()
162 (int) ( t - cur->timestamp ) > cache->timeout ) in mbedtls_ssl_cache_set()
190 if( count >= cache->max_entries ) in mbedtls_ssl_cache_set()
205 if( count >= cache->max_entries ) in mbedtls_ssl_cache_set()
207 if( cache->chain == NULL ) in mbedtls_ssl_cache_set()
213 cur = cache->chain; in mbedtls_ssl_cache_set()
214 cache->chain = cur->next; in mbedtls_ssl_cache_set()
232 cache->chain = cur; in mbedtls_ssl_cache_set()
278 if( mbedtls_mutex_unlock( &cache->mutex ) != 0 ) in mbedtls_ssl_cache_set()
286 void mbedtls_ssl_cache_set_timeout( mbedtls_ssl_cache_context *cache, int timeout ) in mbedtls_ssl_cache_set_timeout() argument
290 cache->timeout = timeout; in mbedtls_ssl_cache_set_timeout()
294 void mbedtls_ssl_cache_set_max_entries( mbedtls_ssl_cache_context *cache, int max ) in mbedtls_ssl_cache_set_max_entries() argument
298 cache->max_entries = max; in mbedtls_ssl_cache_set_max_entries()
301 void mbedtls_ssl_cache_free( mbedtls_ssl_cache_context *cache ) in mbedtls_ssl_cache_free() argument
305 cur = cache->chain; in mbedtls_ssl_cache_free()
322 mbedtls_mutex_free( &cache->mutex ); in mbedtls_ssl_cache_free()