lib: don't compare fd to FD_SETSIZE when using poll
FD_SETSIZE is irrelevant when using poll. So ensuring that the file descriptor is smaller than FD_SETSIZE in VALID_SOCK, can cause multi_wait to ignore perfectly valid file descriptors and simply wait for 1s to avoid hammering the CPU in a busy loop. Fixes #7240 Closes #7241
This commit is contained in:
parent
23eef2394c
commit
d293bf4a78
@ -106,7 +106,11 @@ int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
|
|||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
#else
|
#else
|
||||||
|
#ifdef HAVE_POLL_FINE
|
||||||
|
#define VALID_SOCK(s) ((s) >= 0) /* FD_SETSIZE is irrelevant for poll */
|
||||||
|
#else
|
||||||
#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))
|
#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))
|
||||||
|
#endif
|
||||||
#define VERIFY_SOCK(x) do { \
|
#define VERIFY_SOCK(x) do { \
|
||||||
if(!VALID_SOCK(x)) { \
|
if(!VALID_SOCK(x)) { \
|
||||||
SET_SOCKERRNO(EINVAL); \
|
SET_SOCKERRNO(EINVAL); \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user