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

Merge pull request #160 from mtatton/master

[ win64 ] fix socket blocking
This commit is contained in:
rkd77 2022-05-01 16:36:06 +02:00 committed by GitHub
commit 29566c75c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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