]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: session: implement a basic atomic buffer allocator
authorWilly Tarreau <w@1wt.eu>
Tue, 25 Nov 2014 18:46:36 +0000 (19:46 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 Dec 2014 22:47:32 +0000 (23:47 +0100)
commit656859d47895d077022be9bcec4435dba05c387f
tree5c7c291e09a0d26a1b37996c7637a91388ae1ef2
parentf4718e8ec0ff33f4725291dd5d8ae0cd3c1869f5
MEDIUM: session: implement a basic atomic buffer allocator

This patch introduces session_alloc_recv_buffer(), session_alloc_buffers()
and session_release_buffers() whose purpose will be to allocate missing
buffers and release unneeded ones around the process_session() and during
I/O operations.

I/O callbacks only need a single buffer for recv operations and none
for send. However we still want to ensure that we don't pick the last
buffer. That's what session_alloc_recv_buffer() is for.

This allocator is atomic in that it always ensures we can get 2 buffers
or fails. Here, if any of the buffers is not ready and cannot be
allocated, the operation is cancelled. The purpose is to guarantee that
we don't enter into the deadlock where all buffers are allocated by the
same size of all sessions.

A queue will have to be implemented for failed allocations. For now
they're just reported as failures.
include/proto/session.h
src/session.c