Global state (was: I am back)
wk at gnupg.org
Tue May 16 11:30:17 CEST 2000
On Tue, 16 May 2000, Nikos Mavroyanopoulos wrote:
> Since we have a global state, all these functions do use the global
> variables to determine what to send. Eg gnutls_send_hello() does not require
> any parameters, and will determine from the state an from the available
Although I have not lloked at the code for a while, I have one suggestion:
Do not use global variables, but pass a handle to a structure which
actually is a pointer to an allocated structure carrying the "global"
state. This greatly helps to make the lib reentrant.
You either need an extra function to create a handle or you imlicitly
create the handle by assuming that a handle pointing to NULL has to
be initialized - however, you need a function to release the handle
anyway (using reference counting is somewhat complicated) and
therefore 2 functions would be better.
Werner Koch OpenPGP key 621CC013
OpenIT GmbH tel +49 211 239577-0
Birkenstr. 12 email wk at OpenIT.de
D-40233 Duesseldorf http://www.OpenIT.de
More information about the Gnutls-devel