]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: peers: remove unused "proto" and "xprt" struct members
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 30 Nov 2023 16:24:39 +0000 (17:24 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 21 Dec 2023 13:22:27 +0000 (14:22 +0100)
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.

include/haproxy/peers-t.h
include/haproxy/peers.h
src/cfgparse.c

index 0bf1c9f46a0fcc156923fa2106886769cba0aa15..ed95b076093bb23c742a454ae0ba72f59af540bf 100644 (file)
@@ -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 */
index c12c54154bd830b2e91ce6b6622f97e8306673d3..d100c0c24575d53150b1ab6cd89b131e7b5bb213 100644 (file)
@@ -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 */
 
index b15b1ece77fd0ba5d0e60347c140a729ca15112d..01a959514769c3812f3c9f11750924457326880c 100644 (file)
@@ -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 <newpeer>
-                * 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;