Browse Source

Upgrade libuv to d4563a1

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
62f7c7961d
  1. 10
      deps/uv/config-mingw.mk
  2. 6
      deps/uv/include/uv.h
  3. 10
      deps/uv/msvs/c-ares.vcxproj
  4. 10
      deps/uv/msvs/libuv-benchmark.vcxproj
  5. 10
      deps/uv/msvs/libuv-test.vcxproj
  6. 29
      deps/uv/msvs/libuv.vcxproj
  7. 1
      deps/uv/src/ares/inet_ntop.h
  8. 13
      deps/uv/src/uv-common.c
  9. 17
      deps/uv/src/uv-unix.c
  10. 3194
      deps/uv/src/uv-win.c
  11. 12
      deps/uv/test/test-bind-error.c
  12. 9
      deps/uv/test/test-getsockname.c
  13. 2
      deps/uv/test/test-list.h
  14. 1
      lib/net_uv.js

10
deps/uv/config-mingw.mk

@ -28,17 +28,19 @@ CFLAGS=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0501 -Isrc/ares/config_win32
LINKFLAGS=-lm LINKFLAGS=-lm
CARES_OBJS += src/ares/windows_port.o CARES_OBJS += src/ares/windows_port.o
WIN_SRCS=$(wildcard src/win/*.c)
WIN_OBJS=$(WIN_SRCS:.c=.o)
RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE # Need _GNU_SOURCE for strdup? RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE # Need _GNU_SOURCE for strdup?
RUNNER_LINKFLAGS=$(LINKFLAGS) RUNNER_LINKFLAGS=$(LINKFLAGS)
RUNNER_LIBS=-lws2_32 RUNNER_LIBS=-lws2_32
RUNNER_SRC=test/runner-win.c RUNNER_SRC=test/runner-win.c
uv.a: src/uv-win.o src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS) uv.a: $(WIN_OBJS) src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
$(AR) rcs uv.a src/uv-win.o src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS) $(AR) rcs uv.a src/win/*.o src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
src/uv-win.o: src/uv-win.c include/uv.h include/uv-win.h src/win/%.o: src/win/%.c src/win/internal.h
$(CC) $(CFLAGS) -c src/uv-win.c -o src/uv-win.o $(CC) $(CFLAGS) -o $@ -c $<
src/uv-common.o: src/uv-common.c include/uv.h include/uv-win.h src/uv-common.o: src/uv-common.c include/uv.h include/uv-win.h
$(CC) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o $(CC) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o

6
deps/uv/include/uv.h

@ -514,9 +514,15 @@ int64_t uv_now();
/* Utility */ /* Utility */
/* Convert string ip addresses to binary structures */
struct sockaddr_in uv_ip4_addr(const char* ip, int port); struct sockaddr_in uv_ip4_addr(const char* ip, int port);
struct sockaddr_in6 uv_ip6_addr(const char* ip, int port); struct sockaddr_in6 uv_ip6_addr(const char* ip, int port);
/* Convert binary addresses to strings */
int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size);
int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size);
/* Gets the executable path */ /* Gets the executable path */
int uv_exepath(char* buffer, size_t* size); int uv_exepath(char* buffer, size_t* size);

10
deps/uv/msvs/c-ares.vcxproj

@ -95,14 +95,24 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\ares\ares__close_sockets.c" /> <ClCompile Include="..\src\ares\ares__close_sockets.c" />

10
deps/uv/msvs/libuv-benchmark.vcxproj

@ -55,22 +55,18 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
@ -112,6 +108,8 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Link> <Link>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
@ -120,6 +118,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -129,6 +128,8 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -136,6 +137,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

10
deps/uv/msvs/libuv-test.vcxproj

@ -56,22 +56,18 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)..\build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
@ -113,6 +109,8 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Link> <Link>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
@ -121,6 +119,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -130,6 +129,8 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -137,6 +138,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

29
deps/uv/msvs/libuv.vcxproj

@ -95,13 +95,23 @@
<ClCompile> <ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\src\ares\config_win32</AdditionalIncludeDirectories>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="c-ares.vcxproj"> <ProjectReference Include="c-ares.vcxproj">
@ -115,7 +125,19 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\uv-common.c" /> <ClCompile Include="..\src\uv-common.c" />
<ClCompile Include="..\src\uv-win.c" /> <ClCompile Include="..\src\win\async.c" />
<ClCompile Include="..\src\win\cares.c" />
<ClCompile Include="..\src\win\core.c" />
<ClCompile Include="..\src\win\error.c" />
<ClCompile Include="..\src\win\getaddrinfo.c" />
<ClCompile Include="..\src\win\handle.c" />
<ClCompile Include="..\src\win\loop-watcher.c" />
<ClCompile Include="..\src\win\pipe.c" />
<ClCompile Include="..\src\win\req.c" />
<ClCompile Include="..\src\win\stream.c" />
<ClCompile Include="..\src\win\tcp.c" />
<ClCompile Include="..\src\win\timer.c" />
<ClCompile Include="..\src\win\util.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\include\ares.h" /> <ClInclude Include="..\include\ares.h" />
@ -124,6 +146,11 @@
<ClInclude Include="..\include\uv-win.h" /> <ClInclude Include="..\include\uv-win.h" />
<ClInclude Include="..\include\uv.h" /> <ClInclude Include="..\include\uv.h" />
<ClInclude Include="..\src\uv-common.h" /> <ClInclude Include="..\src\uv-common.h" />
<ClInclude Include="..\src\win\internal.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\config-mingw.mk" />
<None Include="..\Makefile" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

1
deps/uv/src/ares/inet_ntop.h

@ -18,6 +18,7 @@
*/ */
#ifdef HAVE_INET_NTOP #ifdef HAVE_INET_NTOP
#include <arpa/inet.h>
#define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z) #define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z)
#else #else
const char *ares_inet_ntop(int af, const void *src, char *dst, size_t size); const char *ares_inet_ntop(int af, const void *src, char *dst, size_t size);

13
deps/uv/src/uv-common.c

@ -29,6 +29,7 @@
/* use inet_pton from c-ares if necessary */ /* use inet_pton from c-ares if necessary */
#include "ares_config.h" #include "ares_config.h"
#include "ares/inet_net_pton.h" #include "ares/inet_net_pton.h"
#include "ares/inet_ntop.h"
/* list used for ares task handles */ /* list used for ares task handles */
static uv_ares_task_t* uv_ares_handles_ = NULL; static uv_ares_task_t* uv_ares_handles_ = NULL;
@ -112,6 +113,18 @@ struct sockaddr_in6 uv_ip6_addr(const char* ip, int port) {
} }
int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size) {
char* d = ares_inet_ntop(AF_INET, &src->sin_addr, dst, size);
return d != dst;
}
int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size) {
char* d = ares_inet_ntop(AF_INET6, &src->sin6_addr, dst, size);
return d != dst;
}
/* find matching ares handle in list */ /* find matching ares handle in list */
void uv_add_ares_handle(uv_ares_task_t* handle) { void uv_add_ares_handle(uv_ares_task_t* handle) {
handle->ares_next = uv_ares_handles_; handle->ares_next = uv_ares_handles_;

17
deps/uv/src/uv-unix.c

@ -481,14 +481,27 @@ out:
int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) {
int r; int r;
int fd;
assert(tcp->fd >= 0);
if (tcp->delayed_error) { if (tcp->delayed_error) {
uv_err_new((uv_handle_t*)tcp, tcp->delayed_error); uv_err_new((uv_handle_t*)tcp, tcp->delayed_error);
return -1; return -1;
} }
if (tcp->fd <= 0) {
if ((fd = uv__socket(AF_INET, SOCK_STREAM, 0)) == -1) {
uv_err_new((uv_handle_t*)tcp, errno);
return -1;
}
if (uv__stream_open(tcp, fd)) {
close(fd);
return -1;
}
}
assert(tcp->fd >= 0);
r = listen(tcp->fd, backlog); r = listen(tcp->fd, backlog);
if (r < 0) { if (r < 0) {
uv_err_new((uv_handle_t*)tcp, errno); uv_err_new((uv_handle_t*)tcp, errno);

3194
deps/uv/src/uv-win.c

File diff suppressed because it is too large

12
deps/uv/test/test-bind-error.c

@ -188,3 +188,15 @@ TEST_IMPL(bind_localhost_ok) {
return 0; return 0;
} }
TEST_IMPL(listen_without_bind) {
int r;
uv_tcp_t server;
uv_init();
r = uv_tcp_init(&server);
ASSERT(r == 0);
r = uv_tcp_listen(&server, 128, NULL);
ASSERT(r == 0);
}

9
deps/uv/test/test-getsockname.c

@ -151,6 +151,15 @@ static int tcp_listener(int port) {
fprintf(stderr, "uv_getsockname error (listening) %d\n", uv_last_error().code); fprintf(stderr, "uv_getsockname error (listening) %d\n", uv_last_error().code);
} }
ASSERT(r == 0); ASSERT(r == 0);
char ip[20];
r = uv_ip4_name((struct sockaddr_in*)&sockname, ip, 20);
ASSERT(r == 0);
ASSERT(ip[0] == '0');
ASSERT(ip[1] == '.');
ASSERT(ip[2] == '0');
printf("sockname = %s\n", ip);
getsocknamecount++; getsocknamecount++;
return 0; return 0;

2
deps/uv/test/test-list.h

@ -30,6 +30,7 @@ TEST_DECLARE (bind_error_addrnotavail_2)
TEST_DECLARE (bind_error_fault) TEST_DECLARE (bind_error_fault)
TEST_DECLARE (bind_error_inval) TEST_DECLARE (bind_error_inval)
TEST_DECLARE (bind_localhost_ok) TEST_DECLARE (bind_localhost_ok)
TEST_DECLARE (listen_without_bind)
TEST_DECLARE (bind6_error_addrinuse) TEST_DECLARE (bind6_error_addrinuse)
TEST_DECLARE (bind6_error_addrnotavail) TEST_DECLARE (bind6_error_addrnotavail)
TEST_DECLARE (bind6_error_fault) TEST_DECLARE (bind6_error_fault)
@ -82,6 +83,7 @@ TASK_LIST_START
TEST_ENTRY (bind_error_fault) TEST_ENTRY (bind_error_fault)
TEST_ENTRY (bind_error_inval) TEST_ENTRY (bind_error_inval)
TEST_ENTRY (bind_localhost_ok) TEST_ENTRY (bind_localhost_ok)
TEST_ENTRY (listen_without_bind)
TEST_ENTRY (bind6_error_addrinuse) TEST_ENTRY (bind6_error_addrinuse)
TEST_ENTRY (bind6_error_addrnotavail) TEST_ENTRY (bind6_error_addrnotavail)

1
lib/net_uv.js

@ -514,6 +514,7 @@ function listenip(self, ip, port, addressType) {
r = self._handle.bind(ip, port); r = self._handle.bind(ip, port);
} }
} }
if (r) { if (r) {
self._handle.close(); self._handle.close();
self._handle = null; self._handle = null;

Loading…
Cancel
Save