]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: protocol: add a pointer to struct sock_ops to the listener struct
authorEmeric Brun <ebrun@exceliance.fr>
Fri, 18 May 2012 16:30:29 +0000 (18:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 21 May 2012 20:22:39 +0000 (22:22 +0200)
The listener struct is now aware of the socket layer to use upon accept().
At the moment, only sock_raw is supported so this patch should not change
anything.

include/types/protocols.h
src/cfgparse.c
src/dumpstats.c
src/session.c

index bda4922684adae387e2165327ce32596155a2287..ac52a5313e1b89d47995a181e3047bffd477ba51 100644 (file)
@@ -102,6 +102,7 @@ struct listener {
        int options;                    /* socket options : LI_O_* */
        struct licounters *counters;    /* statistics counters */
        struct protocol *proto;         /* protocol this listener belongs to */
+       struct sock_ops *sock;          /* listener socket operations */
        int nbconn;                     /* current number of connections on this listener */
        int maxconn;                    /* maximum connections allowed on this listener */
        unsigned int backlog;           /* if set, listen backlog */
index b3ae050e14e9925129c76ca2e1701e7b614fdcb3..5bd2cfc37178f9cde23f98d2d0a117baddefca8b 100644 (file)
@@ -265,6 +265,7 @@ static int str2listener(char *str, struct proxy *curproxy, const char *file, int
 
                        l->fd = -1;
                        l->addr = ss;
+                       l->sock = &sock_raw;
                        l->state = LI_INIT;
 
                        if (ss.ss_family == AF_INET) {
index 6b4c84e7914177e9e597c6cda083d3b5e78e71a2..14d50e1c67c76a82d07c67c23a1e8edb7b976a9d 100644 (file)
@@ -276,6 +276,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
                        }
                }
 
+               global.stats_sock.sock = &sock_raw;
                uxst_add_listener(&global.stats_sock);
                global.maxsock++;
        }
index fcd113e437a62de66985ecc0e13222e751abb2cb..353fa666d75701d6e080674c9660ca14914333c2 100644 (file)
@@ -180,7 +180,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
                s->si[0].flags = SI_FL_CAP_SPLTCP; /* TCP/TCPv6 splicing possible */
 
        /* add the various callbacks */
-       stream_interface_prepare(&s->si[0], &sock_raw);
+       stream_interface_prepare(&s->si[0], l->sock);
 
        /* pre-initialize the other side's stream interface to an INIT state. The
         * callbacks will be initialized before attempting to connect.