mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 23:01:24 +02:00
MINOR: listener: add a few BUG_ON() statements to detect inconsistencies
We must not have an fd==-1 when switching to certain states. This will later disappear but for now it helps detecting inconsistencies.
This commit is contained in:
parent
e122dc5316
commit
95a3460739
@ -255,14 +255,17 @@ void listener_set_state(struct listener *l, enum li_state st)
|
|||||||
case LI_ASSIGNED:
|
case LI_ASSIGNED:
|
||||||
break;
|
break;
|
||||||
case LI_PAUSED:
|
case LI_PAUSED:
|
||||||
|
BUG_ON(l->rx.fd == -1);
|
||||||
_HA_ATOMIC_ADD(&px->li_paused, 1);
|
_HA_ATOMIC_ADD(&px->li_paused, 1);
|
||||||
break;
|
break;
|
||||||
case LI_LISTEN:
|
case LI_LISTEN:
|
||||||
|
BUG_ON(l->rx.fd == -1);
|
||||||
_HA_ATOMIC_ADD(&px->li_bound, 1);
|
_HA_ATOMIC_ADD(&px->li_bound, 1);
|
||||||
break;
|
break;
|
||||||
case LI_READY:
|
case LI_READY:
|
||||||
case LI_FULL:
|
case LI_FULL:
|
||||||
case LI_LIMITED:
|
case LI_LIMITED:
|
||||||
|
BUG_ON(l->rx.fd == -1);
|
||||||
_HA_ATOMIC_ADD(&px->li_ready, 1);
|
_HA_ATOMIC_ADD(&px->li_ready, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -280,6 +283,7 @@ void enable_listener(struct listener *listener)
|
|||||||
{
|
{
|
||||||
HA_SPIN_LOCK(LISTENER_LOCK, &listener->lock);
|
HA_SPIN_LOCK(LISTENER_LOCK, &listener->lock);
|
||||||
if (listener->state == LI_LISTEN) {
|
if (listener->state == LI_LISTEN) {
|
||||||
|
BUG_ON(listener->rx.fd == -1);
|
||||||
if ((global.mode & (MODE_DAEMON | MODE_MWORKER)) &&
|
if ((global.mode & (MODE_DAEMON | MODE_MWORKER)) &&
|
||||||
!(proc_mask(listener->rx.settings->bind_proc) & pid_bit)) {
|
!(proc_mask(listener->rx.settings->bind_proc) & pid_bit)) {
|
||||||
/* we don't want to enable this listener and don't
|
/* we don't want to enable this listener and don't
|
||||||
|
Loading…
x
Reference in New Issue
Block a user