MEDIUM: appctx: check for allocation attempts in buffer allocation callbacks
authorWilly Tarreau <w@1wt.eu>
Tue, 6 Nov 2018 16:32:37 +0000 (17:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2018 09:18:37 +0000 (10:18 +0100)
commit21028b5e7f02644d88f789a2100b08665d12f1f2
tree5af814aae131155a98100ecac3fd21ba6a8fcf0b
parentb882dd88cc5996b2057ee0131bd59436002c1427
MEDIUM: appctx: check for allocation attempts in buffer allocation callbacks

The buffer allocation callback appctx_res_wakeup() used to rely on old
tricks to detect if a buffer was already granted to an appctx, namely
by checking the task's state. Not only this test is not valid anymore,
but it's inaccurate.

Let's solely on SI_FL_WAIT_ROOM that is now set on allocation failure by
the functions trying to allocate a buffer. The buffer is now allocated on
the fly and the flag removed so that the consistency between the two
remains granted. The patch also fixes minor issues such as the function
being improperly declared inline(!) and the fact that using appctx_wakeup()
sets the wakeup reason to TASK_WOKEN_OTHER while we try to use TASK_WOKEN_RES
when waking up consecutive to a ressource allocation such as a buffer.
include/proto/applet.h
src/applet.c