HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
goto close;
}
- ofs = sft->ofs;
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
LIST_DEL_INIT(&appctx->wait_entry);
* existing messages before grabbing a reference to a location. This
* value cannot be produced after initialization.
*/
- if (unlikely(ofs == ~0)) {
- ofs = 0;
- HA_ATOMIC_INC(b_peek(buf, ofs));
+ if (unlikely(sft->ofs == ~0)) {
+ sft->ofs = b_peek_ofs(buf, 0);
+ HA_ATOMIC_INC(b_orig(buf) + sft->ofs);
}
/* in this loop, ofs always points to the counter byte that precedes
/* we were already there, adjust the offset to be relative to
* the buffer's head and remove us from the counter.
*/
+ ofs = sft->ofs - b_head_ofs(buf);
+ if (sft->ofs < b_head_ofs(buf))
+ ofs += b_size(buf);
BUG_ON(ofs >= buf->size);
HA_ATOMIC_DEC(b_peek(buf, ofs));
HA_ATOMIC_INC(b_peek(buf, ofs));
last_ofs = b_tail_ofs(buf);
- sft->ofs = ofs;
+ sft->ofs = b_peek_ofs(buf, ofs);
}
HA_RWLOCK_RDUNLOCK(LOGSRV_LOCK, &ring->lock);
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
goto close;
}
- ofs = sft->ofs;
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
LIST_DEL_INIT(&appctx->wait_entry);
* existing messages before grabbing a reference to a location. This
* value cannot be produced after initialization.
*/
- if (unlikely(ofs == ~0)) {
- ofs = 0;
- HA_ATOMIC_INC(b_peek(buf, ofs));
+ if (unlikely(sft->ofs == ~0)) {
+ sft->ofs = b_peek_ofs(buf, 0);
+ HA_ATOMIC_INC(b_orig(buf) + sft->ofs);
}
/* in this loop, ofs always points to the counter byte that precedes
/* we were already there, adjust the offset to be relative to
* the buffer's head and remove us from the counter.
*/
+ ofs = sft->ofs - b_head_ofs(buf);
+ if (sft->ofs < b_head_ofs(buf))
+ ofs += b_size(buf);
BUG_ON(ofs >= buf->size);
HA_ATOMIC_DEC(b_peek(buf, ofs));
}
HA_ATOMIC_INC(b_peek(buf, ofs));
- sft->ofs = ofs;
+ sft->ofs = b_peek_ofs(buf, ofs);
}
HA_RWLOCK_RDUNLOCK(LOGSRV_LOCK, &ring->lock);