On Fri, Mar 07, 2014 at 06:16:33PM -0500, Jeffrey Walton wrote:

> I'm have a cache of SSL_CTX's. When a SSL_CTX reference count drops to
> 1, I'd like to remove it from the cache. (1 means the cache holds the
> only copy, so I should be able to remove it and call SSL_CTX_free).
> 
> Is it possible to retrieve the reference count on a SSL_CTX?

This design is odd.  Caches often contain the only copy of something,
and expunge the cached object based on some constraint, maximum
time in cache, maximum number of objects cached (LRU policy), and
so on.  With such designs you just SSL_CTX_free() the context when
dropping it from the cache, and OpenSSL will free it if the cache
held the last reference.

Why does your cache only hold the object so long as there is at
least one current external reference.

-- 
        Viktor.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to