Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BUG FIX (WINDOWS): If BUILD_FOR_RUBY, SetSocketNonblocking now uses f…
…cntl instead of ioctlsocket. Prior to ruby19, these are equivalent, but as of ruby19, fcntl keeps behind-the-scenes state about the nonblocking mode of the socket.

Signed-off-by: Aman Gupta <aman@tmm1.net>
  • Loading branch information
spatulasnout authored and tmm1 committed Jun 14, 2009
1 parent 9ea440a commit 9e0c381
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ext/ed.cpp
Expand Up @@ -33,9 +33,16 @@ bool SetSocketNonblocking (SOCKET sd)
#endif

#ifdef OS_WIN32
#ifdef BUILD_FOR_RUBY
// 14Jun09 Ruby provides its own wrappers for ioctlsocket. On 1.8 this is a simple wrapper,
// however, 1.9 keeps its own state about the socket.
// NOTE: F_GETFL is not supported
return (fcntl (sd, F_SETFL, O_NONBLOCK) == 0) ? true : false;
#else
unsigned long one = 1;
return (ioctlsocket (sd, FIONBIO, &one) == 0) ? true : false;
#endif
#endif
}


Expand Down

0 comments on commit 9e0c381

Please sign in to comment.