mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-02 03:47:53 +08:00
fixed one bug in fiber_server.cpp when using shared stack mode
This commit is contained in:
parent
ba7bb5f03f
commit
eeb441afcb
@ -279,10 +279,28 @@ static int service_unix(ACL_XINETD_CFG_PARSER *xcp, ACL_MASTER_SERV *serv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
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 ACL_MASTER_ADDR *master_stream_addr(const char *addr, char private_val)
|
||||
{
|
||||
//if (strrchr(addr, ':') || strrchr(addr, ACL_ADDR_SEP) || acl_alldig(addr)) {
|
||||
if (acl_valid_ipv6_hostaddr(addr, 0) || acl_valid_ipv4_hostaddr(addr, 0)) {
|
||||
if (is_ipaddr(addr)) {
|
||||
ACL_MASTER_ADDR *ma = (ACL_MASTER_ADDR*)
|
||||
acl_mycalloc(1, sizeof(ACL_MASTER_ADDR));
|
||||
ma->type = ACL_MASTER_SERV_TYPE_INET;
|
||||
|
@ -654,8 +654,13 @@ static void main_thread_loop(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
__sighup_fiber = acl_fiber_create(main_fiber_sighup, NULL,
|
||||
acl_var_fiber_stack_size);
|
||||
ACL_FIBER_ATTR attr;
|
||||
|
||||
acl_fiber_attr_init(&attr);
|
||||
acl_fiber_attr_setstacksize(&attr, acl_var_fiber_stack_size);
|
||||
acl_fiber_attr_setsharestack(&attr, acl_var_fiber_share_stack ? 1 : 0);
|
||||
|
||||
__sighup_fiber = acl_fiber_create2(&attr, main_fiber_sighup, NULL);
|
||||
|
||||
if (acl_var_fiber_use_limit > 0) {
|
||||
acl_fiber_create(main_fiber_monitor_used, NULL, STACK_SIZE);
|
||||
@ -793,9 +798,28 @@ static void servers_alone(const char *addrs, int fdtype, int nthreads)
|
||||
acl_argv_free(tokens);
|
||||
}
|
||||
|
||||
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 (acl_valid_ipv6_hostaddr(addr, 0) || acl_valid_ipv4_hostaddr(addr, 0)) {
|
||||
if (is_ipaddr(addr)) {
|
||||
ACL_SAFE_STRNCPY(buf, addr, size);
|
||||
} else {
|
||||
const char *pri = !strcmp(acl_var_fiber_master_private, "y") ?
|
||||
|
Loading…
Reference in New Issue
Block a user