How to store per-session director data

Nils Goroll slink at schokola.de
Thu Mar 25 16:46:12 CET 2010


Hi,

I am working on a new director which needs per-session state.

At this point, I have added a pointer to the session state:

struct sess {
        unsigned                magic;
#define SESS_MAGIC              0x2c2f9c5a

	...

        /* chosen director and per-director session data */
        struct director         *director;
        struct director_sess    *director_sess;

Right now, space for director_sess is allocated at runtime when needed (from
sp->http->ws), but it would probably be more efficient to simply embed it in
struct sess.

To support session state for other directors, I see some alternatives:

* simply add elements needed for additional directors to director_sess
* make director_sess a void * to some private, run time allocated data
* make it a union

I don't want to make this unnecessary complex, but I would like to chose a
design supported by the core developers.

Any advise on this?

Nils




More information about the varnish-dev mailing list