mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-05 19:52:14 +00:00
[MINOR] add socket address length to the protocols
The protocol struct can be more useful if it also provides address lengths. Add sock_addrlen, as used by bind(), as well as l3_addrlen for hashes.
This commit is contained in:
parent
bd578bbe1a
commit
106bf274c4
@ -78,6 +78,8 @@ struct protocol {
|
||||
int sock_type; /* socket type, as passed to socket() */
|
||||
int sock_prot; /* socket protocol, as passed to socket() */
|
||||
sa_family_t sock_family; /* socket family, for sockaddr */
|
||||
socklen_t sock_addrlen; /* socket address length, used by bind() */
|
||||
int l3_addrlen; /* layer3 address length, used by hashes */
|
||||
int (*read)(int fd); /* generic read function */
|
||||
int (*write)(int fd); /* generic write function */
|
||||
int (*bind_all)(struct protocol *proto); /* bind all unbound listeners */
|
||||
|
@ -1407,6 +1407,8 @@ static struct protocol proto_unix = {
|
||||
.sock_type = SOCK_STREAM,
|
||||
.sock_prot = 0,
|
||||
.sock_family = AF_UNIX,
|
||||
.sock_addrlen = sizeof(struct sockaddr_un),
|
||||
.l3_addrlen = sizeof(((struct sockaddr_un*)0)->sun_path),/* path len */
|
||||
.read = &stream_sock_read,
|
||||
.write = &stream_sock_write,
|
||||
.bind_all = uxst_bind_listeners,
|
||||
|
Loading…
Reference in New Issue
Block a user