Lines Matching refs:scache
283 struct Curl_ssl_scache *scache; in Curl_ssl_scache_create() local
292 scache = calloc(1, sizeof(*scache)); in Curl_ssl_scache_create()
293 if(!scache) { in Curl_ssl_scache_create()
298 scache->default_lifetime_secs = (24*60*60); /* 1 day */ in Curl_ssl_scache_create()
299 scache->peer_count = max_peers; in Curl_ssl_scache_create()
300 scache->peers = peers; in Curl_ssl_scache_create()
301 scache->age = 1; in Curl_ssl_scache_create()
302 for(i = 0; i < scache->peer_count; ++i) { in Curl_ssl_scache_create()
303 scache->peers[i].max_sessions = max_sessions_per_peer; in Curl_ssl_scache_create()
304 Curl_llist_init(&scache->peers[i].sessions, in Curl_ssl_scache_create()
308 *pscache = scache; in Curl_ssl_scache_create()
312 void Curl_ssl_scache_destroy(struct Curl_ssl_scache *scache) in Curl_ssl_scache_destroy() argument
314 if(scache) { in Curl_ssl_scache_destroy()
316 for(i = 0; i < scache->peer_count; ++i) { in Curl_ssl_scache_destroy()
317 cf_ssl_scache_clear_peer(&scache->peers[i]); in Curl_ssl_scache_destroy()
319 free(scache->peers); in Curl_ssl_scache_destroy()
320 free(scache); in Curl_ssl_scache_destroy()
562 struct Curl_ssl_scache *scache, in cf_ssl_find_peer() argument
576 for(i = 0; scache && i < scache->peer_count; i++) { in cf_ssl_find_peer()
577 if(scache->peers[i].ssl_peer_key && in cf_ssl_find_peer()
578 strcasecompare(ssl_peer_key, scache->peers[i].ssl_peer_key) && in cf_ssl_find_peer()
579 cf_ssl_scache_match_auth(&scache->peers[i], conn_config)) { in cf_ssl_find_peer()
581 *ppeer = &scache->peers[i]; in cf_ssl_find_peer()
586 for(i = 0; scache && i < scache->peer_count; i++) { in cf_ssl_find_peer()
587 if(!scache->peers[i].ssl_peer_key && in cf_ssl_find_peer()
588 scache->peers[i].hmac_set && in cf_ssl_find_peer()
589 cf_ssl_scache_match_auth(&scache->peers[i], conn_config)) { in cf_ssl_find_peer()
595 scache->peers[i].key_salt, in cf_ssl_find_peer()
596 sizeof(scache->peers[i].key_salt), in cf_ssl_find_peer()
602 if(!memcmp(scache->peers[i].key_hmac, my_hmac, sizeof(my_hmac))) { in cf_ssl_find_peer()
604 scache->peers[i].ssl_peer_key = strdup(ssl_peer_key); in cf_ssl_find_peer()
605 if(!scache->peers[i].ssl_peer_key) { in cf_ssl_find_peer()
609 *ppeer = &scache->peers[i]; in cf_ssl_find_peer()
622 struct Curl_ssl_scache *scache, in cf_ssl_add_peer() argument
632 result = cf_ssl_find_peer(cf, data, scache, ssl_peer_key, &peer); in cf_ssl_add_peer()
633 if(result || !scache->peer_count) in cf_ssl_add_peer()
642 for(i = 0; i < scache->peer_count; ++i) { in cf_ssl_add_peer()
644 if(!scache->peers[i].ssl_peer_key && !scache->peers[i].hmac_set) { in cf_ssl_add_peer()
645 peer = &scache->peers[i]; in cf_ssl_add_peer()
649 if(!scache->peers[i].sobj && in cf_ssl_add_peer()
650 !Curl_llist_count(&scache->peers[i].sessions)) { in cf_ssl_add_peer()
651 peer = &scache->peers[i]; in cf_ssl_add_peer()
655 if(!peer || (scache->peers[i].age < peer->age)) { in cf_ssl_add_peer()
656 peer = &scache->peers[i]; in cf_ssl_add_peer()
688 struct Curl_ssl_scache *scache, in cf_scache_peer_add_session() argument
696 if(!scache || !scache->peer_count) { in cf_scache_peer_add_session()
704 s->lifetime_secs = scache->default_lifetime_secs; in cf_scache_peer_add_session()
712 result = cf_ssl_add_peer(cf, data, scache, ssl_peer_key, &peer); in cf_scache_peer_add_session()
752 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_put() local
756 result = cf_scache_peer_add_session(cf, data, scache, ssl_peer_key, s); in Curl_ssl_scache_put()
779 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_take() local
785 if(!scache) in Curl_ssl_scache_take()
789 result = cf_ssl_find_peer(cf, data, scache, ssl_peer_key, &peer); in Curl_ssl_scache_take()
795 (scache->age)++; /* increase general age */ in Curl_ssl_scache_take()
796 peer->age = scache->age; /* set this as used in this age */ in Curl_ssl_scache_take()
812 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_add_obj() local
819 result = cf_ssl_add_peer(cf, data, scache, ssl_peer_key, &peer); in Curl_ssl_scache_add_obj()
839 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_get_obj() local
844 if(!scache) in Curl_ssl_scache_get_obj()
847 result = cf_ssl_find_peer(cf, data, scache, ssl_peer_key, &peer); in Curl_ssl_scache_get_obj()
863 struct Curl_ssl_scache *scache = data->state.ssl_scache; in Curl_ssl_scache_remove_all() local
868 if(!scache) in Curl_ssl_scache_remove_all()
872 result = cf_ssl_find_peer(cf, data, scache, ssl_peer_key, &peer); in Curl_ssl_scache_remove_all()