Fix Windows test failures: proper WSAPoll error handling and FD_SETSIZE check

This commit is contained in:
jeka committed 2026-02-16 10:33:43 +03:00
1 parent 6dfeac03a8
commit 78dfdde400
6 files changed
+104 -415

No files matched your search

+5 -1
View File
@@ -438,7 +438,11 @@ err_t uasync_cancel_timeout(struct UASYNC* ua, void* t_id) {
// Instance version
void* uasync_add_socket(struct UASYNC* ua, int fd, socket_callback_t read_cbk, socket_callback_t write_cbk, socket_callback_t except_cbk, void* user_data) {
if (!ua || fd < 0 || fd >= FD_SETSIZE) return NULL; // Bounds check
if (!ua || fd < 0) return NULL;
// FD_SETSIZE check only for POSIX systems - Windows sockets can have any value
#ifndef _WIN32
if (fd >= FD_SETSIZE) return NULL;
#endif
int index = socket_array_add(ua->sockets, fd, read_cbk, write_cbk, except_cbk, user_data);
if (index < 0) return NULL;