Lines Matching refs:scache
306 struct Curl_ssl_scache *scache; in Curl_ssl_scache_create() local
315 scache = calloc(1, sizeof(*scache)); in Curl_ssl_scache_create()
316 if(!scache) { in Curl_ssl_scache_create()
321 scache->default_lifetime_secs = (24*60*60); /* 1 day */ in Curl_ssl_scache_create()
322 scache->peer_count = max_peers; in Curl_ssl_scache_create()
323 scache->peers = peers; in Curl_ssl_scache_create()
324 scache->age = 1; in Curl_ssl_scache_create()
325 for(i = 0; i < scache->peer_count; ++i) { in Curl_ssl_scache_create()
326 scache->peers[i].max_sessions = max_sessions_per_peer; in Curl_ssl_scache_create()
327 Curl_llist_init(&scache->peers[i].sessions, in Curl_ssl_scache_create()
331 *pscache = scache; in Curl_ssl_scache_create()
335 void Curl_ssl_scache_destroy(struct Curl_ssl_scache *scache) in Curl_ssl_scache_destroy() argument
337 if(scache) { in Curl_ssl_scache_destroy()
339 for(i = 0; i < scache->peer_count; ++i) { in Curl_ssl_scache_destroy()
340 cf_ssl_scache_clear_peer(&scache->peers[i]); in Curl_ssl_scache_destroy()
342 free(scache->peers); in Curl_ssl_scache_destroy()
343 free(scache); in Curl_ssl_scache_destroy()
585 struct Curl_ssl_scache *scache, in cf_ssl_find_peer() argument
599 for(i = 0; scache && i < scache->peer_count; i++) { in cf_ssl_find_peer()
600 if(scache->peers[i].ssl_peer_key && in cf_ssl_find_peer()
601 strcasecompare(ssl_peer_key, scache->peers[i].ssl_peer_key) && in cf_ssl_find_peer()
602 cf_ssl_scache_match_auth(&scache->peers[i], conn_config)) { in cf_ssl_find_peer()
604 *ppeer = &scache->peers[i]; in cf_ssl_find_peer()
609 for(i = 0; scache && i < scache->peer_count; i++) { in cf_ssl_find_peer()
610 if(!scache->peers[i].ssl_peer_key && in cf_ssl_find_peer()
611 scache->peers[i].hmac_set && in cf_ssl_find_peer()
612 cf_ssl_scache_match_auth(&scache->peers[i], conn_config)) { in cf_ssl_find_peer()
618 scache->peers[i].key_salt, in cf_ssl_find_peer()
619 sizeof(scache->peers[i].key_salt), in cf_ssl_find_peer()
625 if(!memcmp(scache->peers[i].key_hmac, my_hmac, sizeof(my_hmac))) { in cf_ssl_find_peer()
627 scache->peers[i].ssl_peer_key = strdup(ssl_peer_key); in cf_ssl_find_peer()
628 if(!scache->peers[i].ssl_peer_key) { in cf_ssl_find_peer()
632 *ppeer = &scache->peers[i]; in cf_ssl_find_peer()
645 struct Curl_ssl_scache *scache, in cf_ssl_add_peer() argument
655 result = cf_ssl_find_peer(cf, data, scache, ssl_peer_key, &peer); in cf_ssl_add_peer()
656 if(result || !scache->peer_count) in cf_ssl_add_peer()
665 for(i = 0; i < scache->peer_count; ++i) { in cf_ssl_add_peer()
667 if(!scache->peers[i].ssl_peer_key && !scache->peers[i].hmac_set) { in cf_ssl_add_peer()
668 peer = &scache->peers[i]; in cf_ssl_add_peer()
672 if(!scache->peers[i].sobj && in cf_ssl_add_peer()
673 !Curl_llist_count(&scache->peers[i].sessions)) { in cf_ssl_add_peer()
674 peer = &scache->peers[i]; in cf_ssl_add_peer()
678 if(!peer || (scache->peers[i].age < peer->age)) { in cf_ssl_add_peer()
679 peer = &scache->peers[i]; in cf_ssl_add_peer()
711 struct Curl_ssl_scache *scache, in cf_scache_peer_add_session() argument
719 if(!scache || !scache->peer_count) { in cf_scache_peer_add_session()
727 s->lifetime_secs = scache->default_lifetime_secs; in cf_scache_peer_add_session()
735 result = cf_ssl_add_peer(cf, data, scache, ssl_peer_key, &peer); in cf_scache_peer_add_session()
777 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_put() local
781 result = cf_scache_peer_add_session(cf, data, scache, ssl_peer_key, s); in Curl_ssl_scache_put()
804 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_take() local
811 if(!scache) in Curl_ssl_scache_take()
815 result = cf_ssl_find_peer(cf, data, scache, ssl_peer_key, &peer); in Curl_ssl_scache_take()
821 (scache->age)++; /* increase general age */ in Curl_ssl_scache_take()
822 peer->age = scache->age; /* set this as used in this age */ in Curl_ssl_scache_take()
847 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_add_obj() local
854 result = cf_ssl_add_peer(cf, data, scache, ssl_peer_key, &peer); in Curl_ssl_scache_add_obj()
874 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_get_obj() local
879 if(!scache) in Curl_ssl_scache_get_obj()
882 result = cf_ssl_find_peer(cf, data, scache, ssl_peer_key, &peer); in Curl_ssl_scache_get_obj()
898 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_remove_all() local
903 if(!scache) in Curl_ssl_scache_remove_all()
907 result = cf_ssl_find_peer(cf, data, scache, ssl_peer_key, &peer); in Curl_ssl_scache_remove_all()