mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-02 03:47:53 +08:00
acl_threads_server can bind unix domain socket when using SO_REUSEPORT.
This commit is contained in:
parent
8fea051a7f
commit
837e373a4c
2
Makefile
2
Makefile
@ -109,7 +109,7 @@ endif
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
.PHONY = check help all_lib all samples all clean install uninstall uninstall_all build_one
|
.PHONY = check help all_lib all samples all clean install uninstall uninstall_all build_one
|
||||||
VERSION = 3.5.3-21
|
VERSION = 3.5.3-22
|
||||||
|
|
||||||
default: build_one acl_master
|
default: build_one acl_master
|
||||||
help h:
|
help h:
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
|
||||||
static char *version = "3.5.3-21 20220831-15:18";
|
static char *version = "3.5.3-22 20220914-14:50";
|
||||||
|
|
||||||
const char *acl_version(void)
|
const char *acl_version(void)
|
||||||
{
|
{
|
||||||
|
@ -123,9 +123,9 @@ char *acl_var_aio_event_mode;
|
|||||||
char *acl_var_aio_pid_dir;
|
char *acl_var_aio_pid_dir;
|
||||||
char *acl_var_aio_access_allow;
|
char *acl_var_aio_access_allow;
|
||||||
char *acl_var_aio_accept_alone;
|
char *acl_var_aio_accept_alone;
|
||||||
char *acl_var_aio_log_debug;
|
|
||||||
char *acl_var_aio_dispatch_addr;
|
char *acl_var_aio_dispatch_addr;
|
||||||
char *acl_var_aio_dispatch_type;
|
char *acl_var_aio_dispatch_type;
|
||||||
|
char *acl_var_aio_log_debug;
|
||||||
char *acl_var_aio_deny_info;
|
char *acl_var_aio_deny_info;
|
||||||
|
|
||||||
static ACL_CONFIG_STR_TABLE __conf_str_tab[] = {
|
static ACL_CONFIG_STR_TABLE __conf_str_tab[] = {
|
||||||
@ -135,9 +135,10 @@ static ACL_CONFIG_STR_TABLE __conf_str_tab[] = {
|
|||||||
{ "aio_access_allow", "0.0.0.0:255.255.255.255", &acl_var_aio_access_allow },
|
{ "aio_access_allow", "0.0.0.0:255.255.255.255", &acl_var_aio_access_allow },
|
||||||
{ "aio_event_mode", "select", &acl_var_aio_event_mode },
|
{ "aio_event_mode", "select", &acl_var_aio_event_mode },
|
||||||
{ "aio_accept_alone", "yes", &acl_var_aio_accept_alone },
|
{ "aio_accept_alone", "yes", &acl_var_aio_accept_alone },
|
||||||
{ "master_debug", "", &acl_var_aio_log_debug },
|
|
||||||
{ "aio_dispatch_addr", "", &acl_var_aio_dispatch_addr },
|
{ "aio_dispatch_addr", "", &acl_var_aio_dispatch_addr },
|
||||||
{ "aio_dispatch_type", "default", &acl_var_aio_dispatch_type },
|
{ "aio_dispatch_type", "default", &acl_var_aio_dispatch_type },
|
||||||
|
|
||||||
|
{ "master_debug", "", &acl_var_aio_log_debug },
|
||||||
{ "master_deny_info", "you're not welcome!", &acl_var_aio_deny_info },
|
{ "master_deny_info", "you're not welcome!", &acl_var_aio_deny_info },
|
||||||
|
|
||||||
{ 0, 0, 0 },
|
{ 0, 0, 0 },
|
||||||
|
@ -138,6 +138,7 @@ char *acl_var_threads_dispatch_addr;
|
|||||||
char *acl_var_threads_dispatch_type;
|
char *acl_var_threads_dispatch_type;
|
||||||
char *acl_var_threads_master_service;
|
char *acl_var_threads_master_service;
|
||||||
char *acl_var_threads_master_reuseport;
|
char *acl_var_threads_master_reuseport;
|
||||||
|
char *acl_var_threads_master_private;
|
||||||
|
|
||||||
static int var_threads_master_reuseport = 0;
|
static int var_threads_master_reuseport = 0;
|
||||||
|
|
||||||
@ -149,13 +150,15 @@ static ACL_CONFIG_STR_TABLE __conf_str_tab[] = {
|
|||||||
#else
|
#else
|
||||||
{ "ioctl_event_mode", "select", &acl_var_threads_event_mode },
|
{ "ioctl_event_mode", "select", &acl_var_threads_event_mode },
|
||||||
#endif
|
#endif
|
||||||
{ "master_debug", "", &acl_var_threads_log_debug },
|
|
||||||
{ "ioctl_deny_banner", "You'are not Welcome!", &acl_var_threads_deny_banner },
|
{ "ioctl_deny_banner", "You'are not Welcome!", &acl_var_threads_deny_banner },
|
||||||
{ "ioctl_access_allow", "all", &acl_var_threads_access_allow },
|
{ "ioctl_access_allow", "all", &acl_var_threads_access_allow },
|
||||||
{ "ioctl_dispatch_addr", "", &acl_var_threads_dispatch_addr },
|
{ "ioctl_dispatch_addr", "", &acl_var_threads_dispatch_addr },
|
||||||
{ "ioctl_dispatch_type", "default", &acl_var_threads_dispatch_type },
|
{ "ioctl_dispatch_type", "default", &acl_var_threads_dispatch_type },
|
||||||
|
|
||||||
|
{ "master_debug", "", &acl_var_threads_log_debug },
|
||||||
{ "master_service", "", &acl_var_threads_master_service },
|
{ "master_service", "", &acl_var_threads_master_service },
|
||||||
{ "master_reuseport", "", &acl_var_threads_master_reuseport },
|
{ "master_reuseport", "", &acl_var_threads_master_reuseport },
|
||||||
|
{ "master_private", "n", &acl_var_threads_master_private },
|
||||||
|
|
||||||
{ 0, 0, 0 },
|
{ 0, 0, 0 },
|
||||||
};
|
};
|
||||||
@ -1243,6 +1246,40 @@ static ACL_VSTREAM **server_daemon_open(ACL_EVENT *event,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int is_ipaddr(const char *addr)
|
||||||
|
{
|
||||||
|
// Just only the port, such as: 8088
|
||||||
|
if (acl_alldig(addr)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Such as: ip:port, or ip|port, or :port, or |port
|
||||||
|
if (strrchr(addr, ':') || strrchr(addr, ACL_ADDR_SEP)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acl_valid_ipv6_hostaddr(addr, 0) || acl_valid_ipv4_hostaddr(addr, 0)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void correct_addr(const char *addr, char *buf, size_t size)
|
||||||
|
{
|
||||||
|
if (is_ipaddr(addr)) {
|
||||||
|
ACL_SAFE_STRNCPY(buf, addr, size);
|
||||||
|
} else {
|
||||||
|
const char *pri = !strcmp(acl_var_threads_master_private, "y") ?
|
||||||
|
"private" : "public";
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
_snprintf(buf, size, "%s/%s/%s", acl_var_thread_queue_dir, pri, addr);
|
||||||
|
#else
|
||||||
|
snprintf(buf, size, "%s/%s/%s", acl_var_threads_queue_dir, pri, addr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static ACL_VSTREAM **server_alone_open(ACL_EVENT *event,
|
static ACL_VSTREAM **server_alone_open(ACL_EVENT *event,
|
||||||
acl_pthread_pool_t *threads, const char *addrs)
|
acl_pthread_pool_t *threads, const char *addrs)
|
||||||
{
|
{
|
||||||
@ -1265,11 +1302,14 @@ static ACL_VSTREAM **server_alone_open(ACL_EVENT *event,
|
|||||||
i = 0;
|
i = 0;
|
||||||
acl_foreach(iter, tokens) {
|
acl_foreach(iter, tokens) {
|
||||||
const char* addr = (const char*) iter.data;
|
const char* addr = (const char*) iter.data;
|
||||||
ACL_VSTREAM* sstream = acl_vstream_listen_ex(addr, 128,
|
char addrbuf[512];
|
||||||
|
|
||||||
|
correct_addr(addr, addrbuf, sizeof(addrbuf));
|
||||||
|
ACL_VSTREAM* sstream = acl_vstream_listen_ex(addrbuf, 128,
|
||||||
flag, 0, 0);
|
flag, 0, 0);
|
||||||
if (sstream == NULL) {
|
if (sstream == NULL) {
|
||||||
acl_msg_error("%s(%d): listen %s error(%s)",
|
acl_msg_error("%s(%d): listen %s error(%s)",
|
||||||
myname, __LINE__, addr, acl_last_serror());
|
myname, __LINE__, addrbuf, acl_last_serror());
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -845,7 +845,8 @@ static void server_open(FIBER_SERVER *server, ACL_ARGV *addrs)
|
|||||||
|
|
||||||
acl_foreach(iter, addrs) {
|
acl_foreach(iter, addrs) {
|
||||||
const char* addr = (const char*) iter.data;
|
const char* addr = (const char*) iter.data;
|
||||||
char addrbuf[256];
|
char addrbuf[512];
|
||||||
|
|
||||||
correct_addr(addr, addrbuf, sizeof(addrbuf));
|
correct_addr(addr, addrbuf, sizeof(addrbuf));
|
||||||
ACL_VSTREAM* sstream = acl_vstream_listen_ex(addrbuf, 128,
|
ACL_VSTREAM* sstream = acl_vstream_listen_ex(addrbuf, 128,
|
||||||
flag, 0, 0);
|
flag, 0, 0);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
%define release_id 21
|
%define release_id 22
|
||||||
|
|
||||||
Summary: The powerful c/c++ library
|
Summary: The powerful c/c++ library
|
||||||
Name: acl-libs
|
Name: acl-libs
|
||||||
@ -45,6 +45,10 @@ rm -rf %{buildroot}
|
|||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|
||||||
|
* Wed Sep 14 2022 shuxin.zheng shuxin.zheng@qq.com 3.5.3-22-20220914.14
|
||||||
|
- bugfix: when using SO_REUSEPORT, acl_threads_server.cpp should support
|
||||||
|
binding unix domain socket.
|
||||||
|
|
||||||
* Wed Aug 31 2022 shuxin.zheng shuxin.zheng@qq.com 3.5.3-21-20220821.15
|
* Wed Aug 31 2022 shuxin.zheng shuxin.zheng@qq.com 3.5.3-21-20220821.15
|
||||||
- feature: Openssl has been supported in acl ssl module
|
- feature: Openssl has been supported in acl ssl module
|
||||||
- workaroud: when IO timeout be set 0, which will not block the IO process,
|
- workaroud: when IO timeout be set 0, which will not block the IO process,
|
||||||
|
Loading…
Reference in New Issue
Block a user