MINOR: sink: Remove the tests on the opposite SC state to process messages

The state of the opposite SC is already tested to wait the connection is
established before sending messages. So, there is no reason to test it again
before looping on the ring buffer.
This commit is contained in:
Christopher Faulet 2023-03-31 11:24:48 +02:00
parent 3d949010bc
commit 4b866959d8

View File

@ -364,11 +364,6 @@ static void sink_forward_io_handler(struct appctx *appctx)
HA_ATOMIC_INC(b_orig(buf) + sft->ofs);
}
/* in this loop, ofs always points to the counter byte that precedes
* the message so that we can take our reference there if we have to
* stop before the end (ret=0).
*/
if (sc_opposite(sc)->state == SC_ST_EST) {
/* we were already there, adjust the offset to be relative to
* the buffer's head and remove us from the counter.
*/
@ -378,6 +373,10 @@ static void sink_forward_io_handler(struct appctx *appctx)
BUG_ON(ofs >= buf->size);
HA_ATOMIC_DEC(b_peek(buf, ofs));
/* in this loop, ofs always points to the counter byte that precedes
* the message so that we can take our reference there if we have to
* stop before the end (ret=0).
*/
ret = 1;
while (ofs + 1 < b_data(buf)) {
cnt = 1;
@ -408,7 +407,7 @@ static void sink_forward_io_handler(struct appctx *appctx)
HA_ATOMIC_INC(b_peek(buf, ofs));
last_ofs = b_tail_ofs(buf);
sft->ofs = b_peek_ofs(buf, ofs);
}
HA_RWLOCK_RDUNLOCK(LOGSRV_LOCK, &ring->lock);
if (ret) {
@ -502,11 +501,6 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
HA_ATOMIC_INC(b_orig(buf) + sft->ofs);
}
/* in this loop, ofs always points to the counter byte that precedes
* the message so that we can take our reference there if we have to
* stop before the end (ret=0).
*/
if (sc_opposite(sc)->state == SC_ST_EST) {
/* we were already there, adjust the offset to be relative to
* the buffer's head and remove us from the counter.
*/
@ -516,6 +510,10 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
BUG_ON(ofs >= buf->size);
HA_ATOMIC_DEC(b_peek(buf, ofs));
/* in this loop, ofs always points to the counter byte that precedes
* the message so that we can take our reference there if we have to
* stop before the end (ret=0).
*/
ret = 1;
while (ofs + 1 < b_data(buf)) {
cnt = 1;
@ -549,7 +547,7 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
HA_ATOMIC_INC(b_peek(buf, ofs));
sft->ofs = b_peek_ofs(buf, ofs);
}
HA_RWLOCK_RDUNLOCK(LOGSRV_LOCK, &ring->lock);
if (ret) {