diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2011-10-15 09:02:22 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2011-10-15 09:02:22 +0000 |
commit | ce4946768c5f295b8e11d6e3c420ac9d8f83f8ca (patch) | |
tree | 73ce35e88b6c07e4b5150a4990659c6b7d1099ab /otherlibs | |
parent | fc82a408a374bdf9394c39e88e5e70b25a32ef73 (diff) | |
download | ocaml-ce4946768c5f295b8e11d6e3c420ac9d8f83f8ca.tar.gz |
PR#5328: Windows, Unix.select and non-blocking sockets (untested patch)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11223 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs')
-rwxr-xr-x | otherlibs/win32unix/nonblock.c | 4 | ||||
-rw-r--r-- | otherlibs/win32unix/select.c | 2 | ||||
-rw-r--r-- | otherlibs/win32unix/unixsupport.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/otherlibs/win32unix/nonblock.c b/otherlibs/win32unix/nonblock.c index 8df1048d50..1f2550b058 100755 --- a/otherlibs/win32unix/nonblock.c +++ b/otherlibs/win32unix/nonblock.c @@ -26,7 +26,7 @@ CAMLprim value unix_set_nonblock(socket) win32_maperr(WSAGetLastError()); uerror("unix_set_nonblock", Nothing); } - Flags_fd_val(socket) = Flags_fd_val(socket) | FLAGS_FD_IS_BLOCKING; + Flags_fd_val(socket) = Flags_fd_val(socket) & ~FLAGS_FD_IS_BLOCKING; return Val_unit; } @@ -39,6 +39,6 @@ CAMLprim value unix_clear_nonblock(socket) win32_maperr(WSAGetLastError()); uerror("unix_clear_nonblock", Nothing); } - Flags_fd_val(socket) = Flags_fd_val(socket) & ~FLAGS_FD_IS_BLOCKING; + Flags_fd_val(socket) = Flags_fd_val(socket) | FLAGS_FD_IS_BLOCKING; return Val_unit; } diff --git a/otherlibs/win32unix/select.c b/otherlibs/win32unix/select.c index d96c3d9d28..af9766ff87 100644 --- a/otherlibs/win32unix/select.c +++ b/otherlibs/win32unix/select.c @@ -556,7 +556,7 @@ void socket_poll (HANDLE hStop, void *_data) if (iterQuery->uFlagsFd & FLAGS_FD_IS_BLOCKING) { DEBUG_PRINT("Restore a blocking socket"); - iMode = 1; + iMode = 0; check_error(lpSelectData, WSAEventSelect((SOCKET)(iterQuery->hFileDescr), aEvents[i], 0) != 0 || ioctlsocket((SOCKET)(iterQuery->hFileDescr), FIONBIO, &iMode) != 0); diff --git a/otherlibs/win32unix/unixsupport.c b/otherlibs/win32unix/unixsupport.c index 2a45684a69..f6431955bf 100644 --- a/otherlibs/win32unix/unixsupport.c +++ b/otherlibs/win32unix/unixsupport.c @@ -54,7 +54,7 @@ value win_alloc_handle(HANDLE h) Handle_val(res) = h; Descr_kind_val(res) = KIND_HANDLE; CRT_fd_val(res) = NO_CRT_FD; - Flags_fd_val(res) = 0; + Flags_fd_val(res) = FLAGS_FD_IS_BLOCKING; return res; } @@ -64,7 +64,7 @@ value win_alloc_socket(SOCKET s) Socket_val(res) = s; Descr_kind_val(res) = KIND_SOCKET; CRT_fd_val(res) = NO_CRT_FD; - Flags_fd_val(res) = 0; + Flags_fd_val(res) = FLAGS_FD_IS_BLOCKING; return res; } |