MINOR: connection: remove pointers for prehash in conn_hash_params
Replace unneeded pointers for sni/proxy prehash by plain data type.
The code is slightly cleaner.
diff --git a/include/haproxy/connection-t.h b/include/haproxy/connection-t.h
index 96b5611..77766c4 100644
--- a/include/haproxy/connection-t.h
+++ b/include/haproxy/connection-t.h
@@ -493,10 +493,10 @@
*/
struct conn_hash_params {
struct server *srv;
- XXH64_hash_t *sni_prehash;
+ XXH64_hash_t sni_prehash;
struct sockaddr_storage *src_addr;
struct sockaddr_storage *dst_addr;
- XXH64_hash_t *proxy_prehash;
+ XXH64_hash_t proxy_prehash;
};
/* This structure describes a connection with its methods and data.
diff --git a/src/backend.c b/src/backend.c
index e2fa3c3..b03da4a 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1272,10 +1272,6 @@
int proxy_line_ret;
int64_t hash = 0;
struct conn_hash_params hash_params;
-#ifdef USE_OPENSSL
- XXH64_hash_t sni_hash;
-#endif
- XXH64_hash_t proxy_hash;
/* first, set unique connection parameters and then calculate hash */
memset(&hash_params, 0, sizeof(hash_params));
@@ -1295,9 +1291,9 @@
* not the case
*/
if (sni_smp) {
- sni_hash = conn_hash_prehash(sni_smp->data.u.str.area,
- sni_smp->data.u.str.data);
- hash_params.sni_prehash = &sni_hash;
+ hash_params.sni_prehash =
+ conn_hash_prehash(sni_smp->data.u.str.area,
+ sni_smp->data.u.str.data);
}
}
#endif /* USE_OPENSSL */
@@ -1325,8 +1321,8 @@
if (srv && srv->pp_opts) {
proxy_line_ret = make_proxy_line(trash.area, trash.size, srv, cli_conn, s);
if (proxy_line_ret) {
- proxy_hash = conn_hash_prehash(trash.area, proxy_line_ret);
- hash_params.proxy_prehash = &proxy_hash;
+ hash_params.proxy_prehash =
+ conn_hash_prehash(trash.area, proxy_line_ret);
}
}
diff --git a/src/connection.c b/src/connection.c
index 002d6e7..9263367 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1468,7 +1468,7 @@
if (params->sni_prehash) {
conn_hash_update(buf, &idx,
- params->sni_prehash, sizeof(*params->sni_prehash),
+ ¶ms->sni_prehash, sizeof(params->sni_prehash),
&hash_flags, CONN_HASH_PARAMS_TYPE_SNI);
}
@@ -1488,7 +1488,7 @@
if (params->proxy_prehash) {
conn_hash_update(buf, &idx,
- params->proxy_prehash, sizeof(*params->proxy_prehash),
+ ¶ms->proxy_prehash, sizeof(params->proxy_prehash),
&hash_flags, CONN_HASH_PARAMS_TYPE_PROXY);
}