From: Aurelien DARRAGON Date: Thu, 30 Nov 2023 16:24:39 +0000 (+0100) Subject: CLEANUP: peers: remove unused "proto" and "xprt" struct members X-Git-Tag: v3.0-dev1~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=372d3e29347cb072197200d4a5b7ea3dbad71421;p=thirdparty%2Fhaproxy.git CLEANUP: peers: remove unused "proto" and "xprt" struct members peer->proto and peer->xprt struct members are now pure legacy: they are only set during parsing but never used afterwards. This is due to commit 02efedac ("MINOR: peers: now remove the remote connection setup code") which made some cleanup in the past, but the unused proto and xprt members were probably left unused by mistake. Since we don't have valid uses for them, we remove them. Also, peer_xprt() helper function was removed since it was related to peer->xprt struct member. --- diff --git a/include/haproxy/peers-t.h b/include/haproxy/peers-t.h index 0bf1c9f46a..ed95b07609 100644 --- a/include/haproxy/peers-t.h +++ b/include/haproxy/peers-t.h @@ -60,8 +60,6 @@ struct peer { } conf; /* config information */ time_t last_change; struct sockaddr_storage addr; /* peer address */ - struct protocol *proto; /* peer address protocol */ - struct xprt_ops *xprt; /* peer socket operations at transport layer */ unsigned int flags; /* peer session flags */ unsigned int statuscode; /* current/last session status code */ unsigned int reconnect; /* next connect timer */ diff --git a/include/haproxy/peers.h b/include/haproxy/peers.h index c12c54154b..d100c0c245 100644 --- a/include/haproxy/peers.h +++ b/include/haproxy/peers.h @@ -40,22 +40,10 @@ int peers_register_table(struct peers *, struct stktable *table); void peers_setup_frontend(struct proxy *fe); void peers_register_keywords(struct peers_kw_list *pkwl); -#if defined(USE_OPENSSL) -static inline struct xprt_ops *peer_xprt(struct peer *p) -{ - return p->srv->use_ssl ? xprt_get(XPRT_SSL) : xprt_get(XPRT_RAW); -} -#else static inline enum obj_type *peer_session_target(struct peer *p, struct stream *s) { return &p->srv->obj_type; } -static inline struct xprt_ops *peer_xprt(struct peer *p) -{ - return xprt_get(XPRT_RAW); -} -#endif - #endif /* _HAPROXY_PEERS_H */ diff --git a/src/cfgparse.c b/src/cfgparse.c index b15b1ece77..01a9595147 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -633,7 +633,6 @@ static struct peer *cfg_peers_add_peer(struct peers *peers, p->conf.file = strdup(file); p->conf.line = linenum; p->last_change = ns_to_sec(now_ns); - p->xprt = xprt_get(XPRT_RAW); HA_SPIN_INIT(&p->lock); if (id) p->id = strdup(id); @@ -747,7 +746,6 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) } } newpeer->addr = l->rx.addr; - newpeer->proto = l->rx.proto; cur_arg++; } @@ -902,14 +900,11 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) } /* If the peer address has just been parsed, let's copy it to - * and initializes ->proto. */ if (peer || !local_peer) { newpeer->addr = curpeers->peers_fe->srv->addr; - newpeer->proto = protocol_lookup(newpeer->addr.ss_family, PROTO_TYPE_STREAM, 0); } - newpeer->xprt = xprt_get(XPRT_RAW); HA_SPIN_INIT(&newpeer->lock); newpeer->srv = curpeers->peers_fe->srv;