diff --git a/app/master/daemon/master/master_ent.cpp b/app/master/daemon/master/master_ent.cpp index 01d9916d3..ca445d9cc 100644 --- a/app/master/daemon/master/master_ent.cpp +++ b/app/master/daemon/master/master_ent.cpp @@ -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; diff --git a/app/master/daemon/master/master_listen.cpp b/app/master/daemon/master/master_listen.cpp index f40c782e0..bf0c8c8b5 100644 --- a/app/master/daemon/master/master_listen.cpp +++ b/app/master/daemon/master/master_listen.cpp @@ -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; }