mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
fixed one problem in getaddrinfo of lib_fiber;
This commit is contained in:
parent
1a3faee6ab
commit
e6cead0a67
29
android/acl/.idea/codeStyles/Project.xml
Normal file
29
android/acl/.idea/codeStyles/Project.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
</component>
|
12
android/acl/.idea/gradle.xml
Normal file
12
android/acl/.idea/gradle.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
12
android/acl/.idea/runConfigurations.xml
Normal file
12
android/acl/.idea/runConfigurations.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
6
android/acl/.idea/vcs.xml
Normal file
6
android/acl/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -158,9 +158,9 @@
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_vc2017</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)_vc2015</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)_vc2017</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_vc2017d</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_vc2015d</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_vc2017d</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">$(ProjectName)_d</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">$(ProjectName)_d</TargetName>
|
||||
</PropertyGroup>
|
||||
@ -227,13 +227,13 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y</Command>
|
||||
<PrecompiledHeaderOutputFile>.\Release/acl_lib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Release/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(ProjectName)_vc2015.pdb</ProgramDataBaseFileName>
|
||||
<ProgramDataBaseFileName>$(ProjectName)_vc2017.pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(ProjectName)_vc2015.lib</OutputFile>
|
||||
<OutputFile>$(ProjectName)_vc2017.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Lib>
|
||||
@ -290,14 +290,14 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y</Command>
|
||||
<PrecompiledHeaderOutputFile>$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Debug/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(ProjectName)_vc2015d.pdb</ProgramDataBaseFileName>
|
||||
<ProgramDataBaseFileName>$(ProjectName)_vc2017d.pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(ProjectName)_vc2015d.lib</OutputFile>
|
||||
<OutputFile>$(ProjectName)_vc2017d.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Lib>
|
||||
|
@ -294,11 +294,9 @@ int acl_valid_ipv6_hostaddr(const char *addr_in, int gripe)
|
||||
*ptr = 0;
|
||||
}
|
||||
|
||||
#ifdef ACL_LINUX
|
||||
if ((ptr = strrchr(addr, '%')) != NULL) {
|
||||
*ptr = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
cp = (const unsigned char *) addr;
|
||||
|
||||
|
@ -33,7 +33,7 @@ static void vstring_extend(ACL_VBUF *bp, int incr)
|
||||
* strings we might want to abandon the length doubling strategy,
|
||||
* and go to fixed increments.
|
||||
*/
|
||||
new_len = bp->len + (bp->len > incr ? bp->len : incr);
|
||||
new_len = (long) (bp->len + (bp->len > incr ? bp->len : incr));
|
||||
/*
|
||||
* bp->data = (unsigned char *) acl_myrealloc((char *) bp->data,
|
||||
* new_len);
|
||||
|
@ -112,9 +112,10 @@ int valid_hostaddr(const char *addr, int gripe)
|
||||
|
||||
/* valid_ipv4_hostaddr - test dotted quad string for correctness */
|
||||
|
||||
int valid_ipv4_hostaddr(const char *addr, int gripe)
|
||||
int valid_ipv4_hostaddr(const char *addr_in, int gripe)
|
||||
{
|
||||
char *myname = "valid_ipv4_hostaddr";
|
||||
char addr[128], *ptr;
|
||||
const char *cp;
|
||||
int in_byte = 0;
|
||||
int byte_count = 0;
|
||||
@ -123,6 +124,13 @@ int valid_ipv4_hostaddr(const char *addr, int gripe)
|
||||
|
||||
#define BYTES_NEEDED 4
|
||||
|
||||
SAFE_STRNCPY(addr, addr_in, sizeof(addr));
|
||||
if ((ptr = strrchr(addr, '|')) != NULL) {
|
||||
*ptr = 0;
|
||||
} else if ((ptr = strrchr(addr, ':')) != NULL) {
|
||||
*ptr = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Scary code to avoid sscanf() overflow nasties.
|
||||
*
|
||||
@ -180,13 +188,25 @@ int valid_ipv4_hostaddr(const char *addr, int gripe)
|
||||
|
||||
/* valid_ipv6_hostaddr - validate IPv6 address syntax */
|
||||
|
||||
int valid_ipv6_hostaddr(const char *addr, int gripe)
|
||||
int valid_ipv6_hostaddr(const char *addr_in, int gripe)
|
||||
{
|
||||
const char *myname = "valid_ipv6_hostaddr";
|
||||
int null_field = 0;
|
||||
int field = 0;
|
||||
int null_field = 0;
|
||||
int field = 0;
|
||||
char addr[128], *ptr;
|
||||
const unsigned char *cp = (const unsigned char *) addr;
|
||||
int len = 0;
|
||||
int len = 0;
|
||||
|
||||
SAFE_STRNCPY(addr, addr_in, sizeof(addr));
|
||||
if ((ptr = strrchr(addr, '|')) != NULL) {
|
||||
*ptr = 0;
|
||||
}
|
||||
|
||||
if ((ptr = strrchr(addr, '%')) != NULL) {
|
||||
*ptr = 0;
|
||||
}
|
||||
|
||||
cp = (const unsigned char *) addr;
|
||||
|
||||
/*
|
||||
* FIX 200501 The IPv6 patch validated syntax with getaddrinfo(), but I
|
||||
|
@ -103,6 +103,7 @@ int acl_fiber_getaddrinfo(const char *node, const char *service,
|
||||
{
|
||||
struct dns_addrinfo *dai;
|
||||
struct dns_resolver *resolver;
|
||||
struct addrinfo hints_tmp;
|
||||
int err;
|
||||
|
||||
if (__sys_getaddrinfo == NULL) {
|
||||
@ -148,6 +149,25 @@ int acl_fiber_getaddrinfo(const char *node, const char *service,
|
||||
return EAI_SYSTEM;
|
||||
}
|
||||
|
||||
memset(&hints_tmp, 0, sizeof(hints_tmp));
|
||||
hints_tmp.ai_family = PF_UNSPEC;
|
||||
hints_tmp.ai_socktype = 0;
|
||||
#ifdef __APPLE__
|
||||
hints_tmp.ai_flags = AI_DEFAULT;
|
||||
#elif defined(ANDROID)
|
||||
hints_tmp.ai_flags = AI_ADDRCONFIG;
|
||||
#elif defined(SYS_WIN)
|
||||
hints_tmp.ai_protocol = type == SOCK_DGRAM ? IPPROTO_UDP : IPPROTO_TCP;
|
||||
# if _MSC_VER >= 1500
|
||||
hints_tmp.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
|
||||
# endif
|
||||
#elif !defined(__FreeBSD__)
|
||||
hints_tmp.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
|
||||
#endif
|
||||
if (hints == NULL) {
|
||||
hints = &hints_tmp;
|
||||
}
|
||||
|
||||
dai = dns_ai_open(node, service, DNS_T_A, hints, resolver, &err);
|
||||
if (dai == NULL) {
|
||||
dns_res_close(resolver);
|
||||
|
@ -60,6 +60,7 @@ void CFiberClient::run(void)
|
||||
n++;
|
||||
}
|
||||
delete m_conn;
|
||||
printf("curr id=%u, %u\r\n", get_id(), acl::fiber::self());
|
||||
delete this;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user