]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: Remove useless checks on the receiver protocol existence
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Nov 2024 08:35:00 +0000 (09:35 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Nov 2024 08:35:01 +0000 (09:35 +0100)
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.

src/listener.c

index 10ee800f4302d14ed03ffbf375143eccd7440e46..ec105c310872d8922b5fb0775d333050019b6a5a 100644 (file)
@@ -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;
        }