From: Christopher Faulet Date: Wed, 6 Nov 2024 08:35:00 +0000 (+0100) Subject: MINOR: listener: Remove useless checks on the receiver protocol existence X-Git-Tag: v3.1-dev12~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1cc9340afde6adfe4c7cc06f69cbdf65370c544b;p=thirdparty%2Fhaproxy.git MINOR: listener: Remove useless checks on the receiver protocol existence The receiver protocol is always set when a listener is created or cloned. At least for now. And there is no check on it at many places, except in listener_accept() function. So, let's remove remaining useless checks. That will avoid false Coverity reports in future. This patch should fix the issue #2631. --- diff --git a/src/listener.c b/src/listener.c index 10ee800f43..ec105c3108 100644 --- a/src/listener.c +++ b/src/listener.c @@ -1034,7 +1034,7 @@ void listener_accept(struct listener *l) int ret; p = l->bind_conf->frontend; - bind_tid_commit = l->rx.proto ? l->rx.proto->bind_tid_commit : NULL; + bind_tid_commit = l->rx.proto->bind_tid_commit; /* if l->bind_conf->maxaccept is -1, then max_accept is UINT_MAX. It is * not really illimited, but it is probably enough. @@ -1473,7 +1473,7 @@ void listener_accept(struct listener *l) * reservation in the target ring. */ - if (l->rx.proto && l->rx.proto->bind_tid_prep) { + if (l->rx.proto->bind_tid_prep) { if (l->rx.proto->bind_tid_prep(cli_conn, t)) { /* Failed migration, stay on the same thread. */ goto local_accept; @@ -1498,7 +1498,7 @@ void listener_accept(struct listener *l) */ _HA_ATOMIC_INC(&activity[t].accq_full); - if (l->rx.proto && l->rx.proto->bind_tid_reset) + if (l->rx.proto->bind_tid_reset) l->rx.proto->bind_tid_reset(cli_conn); } #endif // USE_THREAD @@ -1573,7 +1573,7 @@ void listener_accept(struct listener *l) /* This may be a shared socket that was paused by another process. * Let's put it to pause in this case. */ - if (l->rx.proto && l->rx.proto->rx_listening(&l->rx) == 0) { + if (l->rx.proto->rx_listening(&l->rx) == 0) { suspend_listener(l, 0, 0); goto end; }