提交 e1f6d21c 编写于 作者: J Jonathan Pickett

stability fixes

上级 7071e9d5
...@@ -1023,13 +1023,14 @@ static redisContext *redisContextInit(void) { ...@@ -1023,13 +1023,14 @@ static redisContext *redisContextInit(void) {
} }
void redisFree(redisContext *c) { void redisFree(redisContext *c) {
if (c->fd > 0) if (c->fd > 0) {
#ifdef _WIN32 #ifdef _WIN32
closesocket(c->fd); closesocket(c->fd);
smRemoveSocket(c->fd); smRemoveSocket(c->fd);
#else #else
close(c->fd); close(c->fd);
#endif #endif
}
if (c->obuf != NULL) if (c->obuf != NULL)
sdsfree(c->obuf); sdsfree(c->obuf);
if (c->reader != NULL) if (c->reader != NULL)
......
...@@ -367,8 +367,13 @@ int redisContextPreConnectTcp(redisContext *c, const char *addr, int port, ...@@ -367,8 +367,13 @@ int redisContextPreConnectTcp(redisContext *c, const char *addr, int port,
int blocking = (c->flags & REDIS_BLOCK); int blocking = (c->flags & REDIS_BLOCK);
unsigned long inAddress; unsigned long inAddress;
if ((s = redisCreateSocket(c,AF_INET)) < 0) if ((s = redisCreateSocket(c,AF_INET)) < 0) {
return REDIS_ERR; return REDIS_ERR;
}
else {
smAddSocket(s);
}
sa->sin_family = AF_INET; sa->sin_family = AF_INET;
sa->sin_port = htons(port); sa->sin_port = htons(port);
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WIN32IOCP;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32IOCP;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WIN32IOCP;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32IOCP;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_WIN32IOCP;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32IOCP;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_WIN32IOCP;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32IOCP;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\hiredis;$(SolutionDir)..\deps\linenoise</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_WIN32IOCP;WIN32;_DEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32IOCP;WIN32;_DEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_WIN32IOCP;WIN32;_DEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32IOCP;WIN32;_DEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_WIN32IOCP;WIN32;NDEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32IOCP;WIN32;NDEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4996;4146</DisableSpecificWarnings> <DisableSpecificWarnings>4996;4146</DisableSpecificWarnings>
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_WIN32IOCP;WIN32;NDEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32IOCP;WIN32;NDEBUG;_CONSOLE;__x86_64__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)..\deps\lua\src;$(SolutionDir)..\deps\hiredis</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4996;4146</DisableSpecificWarnings> <DisableSpecificWarnings>4996;4146</DisableSpecificWarnings>
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4244;4018</DisableSpecificWarnings> <DisableSpecificWarnings>4244;4018</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4244;4018</DisableSpecificWarnings> <DisableSpecificWarnings>4244;4018</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4244;4018</DisableSpecificWarnings> <DisableSpecificWarnings>4244;4018</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableSpecificWarnings>4244;4018</DisableSpecificWarnings> <DisableSpecificWarnings>4244;4018</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
......
...@@ -53,8 +53,7 @@ sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx; ...@@ -53,8 +53,7 @@ sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx;
* socket value is not an index. Convert socket to index * socket value is not an index. Convert socket to index
* and then find matching structure in list */ * and then find matching structure in list */
/* prefer prime number for number of indexes */ #define MAX_SOCKET_LOOKUP 65535
#define MAX_SOCKET_LOOKUP 1021
/* structure that keeps state of sockets and Completion port handle */ /* structure that keeps state of sockets and Completion port handle */
typedef struct aeApiState { typedef struct aeApiState {
...@@ -65,10 +64,9 @@ typedef struct aeApiState { ...@@ -65,10 +64,9 @@ typedef struct aeApiState {
list closing; list closing;
} aeApiState; } aeApiState;
/* convert socket value to an index /* uses virtual FD as an index */
* Use simple modulo. We can add hash if needed */
int aeSocketIndex(int fd) { int aeSocketIndex(int fd) {
return fd % MAX_SOCKET_LOOKUP; return smLookupFD( fd );
} }
/* get data for socket / fd being monitored. Create if not found*/ /* get data for socket / fd being monitored. Create if not found*/
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#else
#include <stdio.h>
#endif #endif
#include <sys/stat.h> #include <sys/stat.h>
...@@ -414,6 +416,11 @@ int rdbSaveDoubleValue(rio *rdb, double val) { ...@@ -414,6 +416,11 @@ int rdbSaveDoubleValue(rio *rdb, double val) {
int rdbLoadDoubleValue(rio *rdb, double *val) { int rdbLoadDoubleValue(rio *rdb, double *val) {
char buf[128]; char buf[128];
unsigned char len; unsigned char len;
#ifdef _WIN32
double scannedVal = 0;
int assigned = 0;
memset(buf, 128, 0);
#endif
if (rioRead(rdb,&len,1) == 0) return -1; if (rioRead(rdb,&len,1) == 0) return -1;
switch(len) { switch(len) {
...@@ -423,8 +430,18 @@ int rdbLoadDoubleValue(rio *rdb, double *val) { ...@@ -423,8 +430,18 @@ int rdbLoadDoubleValue(rio *rdb, double *val) {
default: default:
if (rioRead(rdb,buf,len) == 0) return -1; if (rioRead(rdb,buf,len) == 0) return -1;
buf[len] = '\0'; buf[len] = '\0';
#ifdef _WIN32
assigned = sscanf_s(buf, "%lg", &scannedVal);
if( assigned != 0 ) {
(*val) = scannedVal;
return 0;
} else {
return -1;
}
#else
sscanf(buf, "%lg", val); sscanf(buf, "%lg", val);
return 0; return 0;
#endif
} }
} }
...@@ -1338,13 +1355,15 @@ void stopLoading(void) { ...@@ -1338,13 +1355,15 @@ void stopLoading(void) {
} }
int rdbLoad(char *filename) { int rdbLoad(char *filename) {
uint32_t dbid; uint32_t dbid = 0;
int type, rdbver; int type = 0;
int rdbver = 0;
redisDb *db = server.db+0; redisDb *db = server.db+0;
char buf[1024]; char buf[1024];
long long expiretime, now = mstime(); long long expiretime;
long now = mstime();
long loops = 0; long loops = 0;
FILE *fp; FILE *fp = NULL;
rio rdb; rio rdb;
#ifdef _WIN32 #ifdef _WIN32
......
...@@ -39,7 +39,9 @@ ...@@ -39,7 +39,9 @@
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
#ifndef _WIN32
extern char **environ; extern char **environ;
#endif
#define REDIS_SENTINEL_PORT 26379 #define REDIS_SENTINEL_PORT 26379
...@@ -671,7 +673,11 @@ void sentinelRunPendingScripts(void) { ...@@ -671,7 +673,11 @@ void sentinelRunPendingScripts(void) {
sj->pid = 0; sj->pid = 0;
} else if (pid == 0) { } else if (pid == 0) {
/* Child */ /* Child */
#ifdef _WIN32
_execv(sj->argv[0],sj->argv);
#else
execve(sj->argv[0],sj->argv,environ); execve(sj->argv[0],sj->argv,environ);
#endif
/* If we are here an error occurred. */ /* If we are here an error occurred. */
_exit(2); /* Don't retry execution. */ _exit(2); /* Don't retry execution. */
} else { } else {
......
...@@ -442,6 +442,7 @@ void aeShutdown(int fd) { ...@@ -442,6 +442,7 @@ void aeShutdown(int fd) {
/* when closing socket, need to unassociate completion port */ /* when closing socket, need to unassociate completion port */
int aeWinCloseSocket(int fd) { int aeWinCloseSocket(int fd) {
aeSockState *sockstate; aeSockState *sockstate;
BOOL closed = FALSE;
if ((sockstate = aeGetSockState(iocpState, fd)) == NULL) { if ((sockstate = aeGetSockState(iocpState, fd)) == NULL) {
closesocket((SOCKET)fd); closesocket((SOCKET)fd);
...@@ -455,12 +456,14 @@ int aeWinCloseSocket(int fd) { ...@@ -455,12 +456,14 @@ int aeWinCloseSocket(int fd) {
if (sockstate->wreqs == 0 && if (sockstate->wreqs == 0 &&
(sockstate->masks & (READ_QUEUED | CONNECT_PENDING | SOCKET_ATTACHED)) == 0) { (sockstate->masks & (READ_QUEUED | CONNECT_PENDING | SOCKET_ATTACHED)) == 0) {
closesocket((SOCKET)fd); closesocket((SOCKET)fd);
smRemoveSocket(fd); closed = TRUE;
} else { } else {
sockstate->masks |= CLOSE_PENDING; sockstate->masks |= CLOSE_PENDING;
} }
aeDelSockState(iocpState, sockstate); aeDelSockState(iocpState, sockstate);
if (closed == TRUE) smRemoveSocket(fd);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册