]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: fix improper insert in avail tree for always reuse
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 20 Oct 2021 13:22:20 +0000 (15:22 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 22 Oct 2021 15:26:22 +0000 (17:26 +0200)
In connect_server(), if http-reuse always is set, the backend connection
is inserted into the available tree as soon as created. However, the
hash connection field is only set later at the end of the function.

This seems to have no impact as the hash connection field is always
position before a lookup. However, this is not a proper usage of ebmb
API. Fix this by setting the hash connection field before the insertion
into the avail tree.

This must be backported up to 2.4.

src/backend.c

index 4c7aba1f890df7f92bf604aa29794a37dc21b82b..6d77864db90228c7d6f8ccc1608726dd0af00faa 100644 (file)
@@ -1523,6 +1523,8 @@ skip_reuse:
                                conn_free(srv_conn);
                                return SF_ERR_RESOURCE;
                        }
+
+                       srv_conn->hash_node->hash = hash;
                }
        }
 
@@ -1746,8 +1748,6 @@ skip_reuse:
                }
        }
 
-       srv_conn->hash_node->hash = hash;
-
        return SF_ERR_NONE;  /* connection is OK */
 }