acl_master can handle master_reuseport from configure for udp server that the port should be bound by acl_master or the app service.

This commit is contained in:
zsx 2018-10-23 15:40:39 +08:00
parent 35221f528b
commit 1b69ade656
2 changed files with 10 additions and 5 deletions

View File

@ -455,7 +455,7 @@ static int service_transport(ACL_XINETD_CFG_PARSER *xcp, ACL_MASTER_SERV *serv)
return -1;
}
if (get_bool_ent(xcp, ACL_VAR_MASTER_SERV_REUSEPORT, "n"))
if (get_bool_ent(xcp, ACL_VAR_MASTER_SERV_REUSEPORT, "y"))
serv->inet_flags |= ACL_INET_FLAG_REUSEPORT;
if (get_bool_ent(xcp, ACL_VAR_MASTER_SERV_FASTOPEN, "n"))
serv->inet_flags |= ACL_INET_FLAG_FASTOPEN;

View File

@ -129,13 +129,18 @@ static int master_listen_inet(ACL_MASTER_SERV *serv)
static int master_bind_udp(ACL_MASTER_SERV *serv)
{
#ifdef SO_REUSEPORT
serv->listen_fd_count = 0;
#else
const char *myname = "master_bind_udp";
ACL_ITER iter;
int i = 0;
#ifdef SO_REUSEPORT
if ((serv->inet_flags & ACL_INET_FLAG_REUSEPORT) != 0) {
serv->listen_fd_count = 0;
acl_msg_info("%s(%d): master_reuseport set", myname, __LINE__);
return 0;
}
#endif
if (serv->listen_fd_count != acl_array_size(serv->addrs))
acl_msg_panic("listen_fd_count(%d) != addrs's size(%d)",
serv->listen_fd_count, acl_array_size(serv->addrs));
@ -177,7 +182,7 @@ static int master_bind_udp(ACL_MASTER_SERV *serv)
__FILE__, __LINE__, myname);
serv->listen_fd_count = i;
}
#endif
return serv->listen_fd_count;
}