win: Use socket.dup() on Windows

This commit is contained in:
Yury Selivanov 2016-11-22 12:53:20 -05:00
parent 9a85c1431c
commit c2defd0359
1 changed files with 11 additions and 0 deletions

View File

@ -58,6 +58,17 @@ cdef _is_sock_dgram(sock_type):
return (sock_type & 0xF) == uv.SOCK_DGRAM
cdef __dup(sock):
# cross-platform duping
IF UNAME_SYSNAME == "Windows":
dup_sock = sock.dup()
fileno = dup_sock.fileno()
dup_sock.detach()
return fileno
ELSE:
return os_dup(sock.fileno())
cdef isfuture(obj):
if aio_isfuture is None:
return isinstance(obj, aio_Future)