1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[ win64 ] fix socket blocking

This commit is contained in:
Unknown 2022-05-01 14:23:31 +00:00
parent 2624d22b6e
commit 97d586a403

View File

@ -78,12 +78,12 @@ int
set_nonblocking_fd(int fd) set_nonblocking_fd(int fd)
{ {
#ifdef WIN32 #ifdef WIN32
/* on current mingw (202204) if (fd > 1024) {
* this is correct usage of winsock u_long mode = 1; // set socket non-blocking
* when compiling for win32 */ ioctlsocket(fd, FIONBIO, &mode);
u_long mode = 1; // set non-blocking socket return 0;
return ioctlsocket(fd, FIONBIO, &mode); }
# else # endif
#if defined(O_NONBLOCK) || defined(O_NDELAY) #if defined(O_NONBLOCK) || defined(O_NDELAY)
int flags = fcntl(fd, F_GETFL, 0); int flags = fcntl(fd, F_GETFL, 0);
@ -101,8 +101,6 @@ set_nonblocking_fd(int fd)
#else #else
return 0; return 0;
#endif #endif
#endif
} }
/* Set a file descriptor to blocking mode. It returns a non-zero value on /* Set a file descriptor to blocking mode. It returns a non-zero value on
@ -111,12 +109,12 @@ int
set_blocking_fd(int fd) set_blocking_fd(int fd)
{ {
#ifdef WIN32 #ifdef WIN32
/* on current mingw (202204) if (fd > 1024) {
* this is correct usage of winsock u_long mode = 0; // set socket blocking
* when compiling for win32 */ ioctlsocket(fd, FIONBIO, &mode);
u_long mode = 0; // set blocking socket return 0;
return ioctlsocket(fd, FIONBIO, &mode); }
# else # endif
#if defined(O_NONBLOCK) || defined(O_NDELAY) #if defined(O_NONBLOCK) || defined(O_NDELAY)
int flags = fcntl(fd, F_GETFL, 0); int flags = fcntl(fd, F_GETFL, 0);
@ -134,7 +132,6 @@ set_blocking_fd(int fd)
#else #else
return 0; return 0;
#endif #endif
#endif
} }
void void