]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: stream-interface: dynamically allocate the applet context
authorWilly Tarreau <w@1wt.eu>
Sun, 1 Dec 2013 10:31:38 +0000 (11:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 14:40:23 +0000 (15:40 +0100)
commit0a23bcb8bec454964bf64cfd85dfa923b66dd041
treea25a1ddfb2d44f5b9ecce84f4642331dcc9fb964
parent1fbe1c9ec83e7cdcbcd6e0f902277039900adfb5
MAJOR: stream-interface: dynamically allocate the applet context

From now on, a call to stream_int_register_handler() causes a call
to si_alloc_appctx() and returns an initialized appctx for the
current stream interface. If one was previously allocated, it is
released. If the stream interface was attached to a connection, it
is released as well.

The appctx are allocated from the same pools as the connections, because
they're substantially smaller in size, and we can't have both a connection
and an appctx on an interface at any moment.

In case of memory shortage, the call may return NULL, which is already
handled by all consumers of stream_int_register_handler().

The field appctx was removed from the stream interface since we only
rely on the endpoint now. On 32-bit, the stream_interface size went down
from 108 to 44 bytes. On 64-bit, it went down from 144 to 64 bytes. This
represents a memory saving of 160 bytes per session.

It seems that a later improvement could be to move the call to
stream_int_register_handler() to session.c for most cases.
include/proto/stream_interface.h
include/types/stream_interface.h
src/stream_interface.c