Skip to content

Commit

Permalink
common/sockets: fix logic error in WIN32 sock_set_nonblocking() impl
Browse files Browse the repository at this point in the history
According to
https://learn.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls
"The lpvInBuffer parameter points at an unsigned long (QoS), which is
nonzero if non-blocking mode is to be enabled and zero if it is to be
disabled."

Closes #613
  • Loading branch information
bk138 committed Aug 4, 2024
1 parent 0e7caa1 commit e9bd7bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
rfbBool sock_set_nonblocking(rfbSocket sock, rfbBool non_blocking, void (*log)(const char *format, ...))
{
#ifdef WIN32
unsigned long block = non_blocking ? 0 : 1;
if(ioctlsocket(sock, FIONBIO, &block) == SOCKET_ERROR) {
unsigned long non_blocking_ulong = non_blocking;
if(ioctlsocket(sock, FIONBIO, &non_blocking_ulong) == SOCKET_ERROR) {
errno=WSAGetLastError();
#else
int flags = fcntl(sock, F_GETFL);
Expand Down

0 comments on commit e9bd7bd

Please sign in to comment.