MINOR: sink/api: pass explicit maxlen parameter to sink_write()
sink_write() currently relies on sink->maxlen to know when to stop
writing a given payload.
But it could be useful to pass a smaller, explicit value to sink_write()
to stop before the ring maxlen, for instance if the ring is shared between
multiple feeders.
sink_write() now takes an optional maxlen parameter:
if maxlen is > 0, then sink_write will stop writing at maxlen if maxlen
is smaller than ring->maxlen, else only ring->maxlen will be considered.
[for haproxy <= 2.7, patch must be applied by hand: that is:
__sink_write() and sink_write() should be patched to take maxlen into
account and function calls to sink_write() should use 0 as second argument
to keep original behavior]
(cherry picked from commit b6e2d62fb3c3015f2da87e2c78cc562b3a0fc391)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 5bab37ef46d9db6653fc08fa03619c2cb35a66ae)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit ce691552a45387dd96b3ae1d5a5d3b323c6d69c8)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit d9aff564ef1a55cea2eeaefd96f23f84138984c3)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/log.c b/src/log.c
index 51829c1..90c32aa 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1886,7 +1886,7 @@
if (msg.len > logsrv->maxlen)
msg.len = logsrv->maxlen;
- sent = sink_write(logsrv->sink, &msg, 1, level, facility, metadata);
+ sent = sink_write(logsrv->sink, 0, &msg, 1, level, facility, metadata);
}
else if (logsrv->addr.ss_family == AF_CUST_EXISTING_FD) {
struct ist msg;