Skip to content
Prev Previous commit
Next Next commit
win: Use socket.dup() on Windows
  • Loading branch information
Yury Selivanov
Yury Selivanov committed Nov 26, 2017
commit c2defd035911bccdf76b28e230eafe523135c265
11 changes: 11 additions & 0 deletions uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down