Merged revisions 84450 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84450 | daniel.stutzbach | 2010-09-03 07:38:33 -0500 (Fri, 03 Sep 2010) | 1 line Fix Issue9753: socket.dup() does not always work right on Windows ........
This commit is contained in:
parent
b82d5e1525
commit
ee541e0d81
@ -105,6 +105,9 @@ C-API
|
|||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #9753: Fixed socket.dup, which did not always work correctly
|
||||||
|
on Windows.
|
||||||
|
|
||||||
- Issue #1868: Eliminate subtle timing issues in thread-local objects by
|
- Issue #1868: Eliminate subtle timing issues in thread-local objects by
|
||||||
getting rid of the cached copy of thread-local attribute dictionary.
|
getting rid of the cached copy of thread-local attribute dictionary.
|
||||||
|
|
||||||
|
@ -351,16 +351,13 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
|
|||||||
static SOCKET
|
static SOCKET
|
||||||
dup_socket(SOCKET handle)
|
dup_socket(SOCKET handle)
|
||||||
{
|
{
|
||||||
HANDLE newhandle;
|
WSAPROTOCOL_INFO info;
|
||||||
|
|
||||||
if (!DuplicateHandle(GetCurrentProcess(), (HANDLE)handle,
|
if (WSADuplicateSocket(handle, GetCurrentProcessId(), &info))
|
||||||
GetCurrentProcess(), &newhandle,
|
|
||||||
0, FALSE, DUPLICATE_SAME_ACCESS))
|
|
||||||
{
|
|
||||||
WSASetLastError(GetLastError());
|
|
||||||
return INVALID_SOCKET;
|
return INVALID_SOCKET;
|
||||||
}
|
|
||||||
return (SOCKET)newhandle;
|
return WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
|
||||||
|
FROM_PROTOCOL_INFO, &info, 0, 0);
|
||||||
}
|
}
|
||||||
#define SOCKETCLOSE closesocket
|
#define SOCKETCLOSE closesocket
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user