diff options
author | root <root> | 2008-06-09 14:11:30 +0000 |
---|---|---|
committer | root <root> | 2008-06-09 14:11:30 +0000 |
commit | dfe85dfd86119bfeed3e3b9e0b56f0e01e796de4 (patch) | |
tree | 45f45b80915e07d8ee19e5e94384b089c5646bc0 /ev_select.c | |
parent | df745b4f0e6329cf025a819384736eee93115072 (diff) |
*** empty log message ***
Diffstat (limited to 'ev_select.c')
-rw-r--r-- | ev_select.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/ev_select.c b/ev_select.c index 1303a56..93d84cf 100644 --- a/ev_select.c +++ b/ev_select.c @@ -79,15 +79,24 @@ select_modify (EV_P_ int fd, int oev, int nev) int handle = fd; #endif - if (nev & EV_READ) - FD_SET (handle, (fd_set *)vec_ri); - else - FD_CLR (handle, (fd_set *)vec_ri); - - if (nev & EV_WRITE) - FD_SET (handle, (fd_set *)vec_wi); - else - FD_CLR (handle, (fd_set *)vec_wi); + /* FD_SET is broken on windows (it adds the fd to a set twice or more, + * which eventually leads to overflows). Need to call it only on changes. + */ + #if EV_SELECT_IS_WINSOCKET + if ((oev ^ nev) & EV_READ) + #endif + if (nev & EV_READ) + FD_SET (handle, (fd_set *)vec_ri); + else + FD_CLR (handle, (fd_set *)vec_ri); + + #if EV_SELECT_IS_WINSOCKET + if ((oev ^ nev) & EV_WRITE) + #endif + if (nev & EV_WRITE) + FD_SET (handle, (fd_set *)vec_wi); + else + FD_CLR (handle, (fd_set *)vec_wi); #else |