On Sun, Mar 20, 2011 at 07:13:18PM -0700, Claus Assmann wrote:

> On Sun, Mar 20, 2011, Victor Duchovni wrote:
> 
> > once, ... so there needs to be some once-only code in your application,
> 
> That's trivial to do and already working fine.
> 
> > and setting a write-once global there does not seem burdensome.
> 
> As Graham points out it makes it hard for some applications to use
> multiple contexts.

There is no problem with multiple contexts, all the complexity is in
initializing multiple "index" values, so that sessions can carry bits
of information from multiple layers of the application.

> In my case I have libraries that implement server
> side and client side, and I want to be able to run them in separate
> processes or in a common process. In the latter case having global
> variables makes the implementation more complex than it should be.

I don't see the difficulty, you can have as many contexts as you want,
none of them global, what's global is the "index" number used to save
a given context into the session. You initialize as many different
indices as you when the application starts. If the same session is
never both a server and a client session, you can even use a single
index, and tag the type of the structure saved at that index as
either a server or client context.

Can you explain a bit more clearly why you can't initialize an
integer index or two when the application starts?

-- 
        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