From d88fd824b7f0f1dd53fd962ffdfed82661a25b09 Mon Sep 17 00:00:00 2001 From: Emeric Brun Date: Fri, 18 May 2012 18:30:29 +0200 Subject: [PATCH] MEDIUM: protocol: add a pointer to struct sock_ops to the listener struct 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 | 1 + src/cfgparse.c | 1 + src/dumpstats.c | 1 + src/session.c | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/types/protocols.h b/include/types/protocols.h index bda492268..ac52a5313 100644 --- a/include/types/protocols.h +++ b/include/types/protocols.h @@ -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 */ diff --git a/src/cfgparse.c b/src/cfgparse.c index b3ae050e1..5bd2cfc37 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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) { diff --git a/src/dumpstats.c b/src/dumpstats.c index 6b4c84e79..14d50e1c6 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -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++; } diff --git a/src/session.c b/src/session.c index fcd113e43..353fa666d 100644 --- a/src/session.c +++ b/src/session.c @@ -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.