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.
This commit is contained in:
Emeric Brun 2012-05-18 18:30:29 +02:00 committed by Willy Tarreau
parent 21adb02d19
commit d88fd824b7
4 changed files with 4 additions and 1 deletions

View 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 */

View 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) {

View 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++;
}

View 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.