diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-02-19 23:02:31 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-02-19 23:03:35 +0300 |
commit | d9b6e400f8c6103fa08532dd33ef4cc714faa994 (patch) | |
tree | 1fba25d9a1987770a60b34cbe82c615a85e22d7c /src/microhttpd/mhd_sockets.h | |
parent | b473e121317ca280e2070914033d9e26f0e7ddab (diff) | |
download | libmicrohttpd-d9b6e400f8c6103fa08532dd33ef4cc714faa994.tar.gz libmicrohttpd-d9b6e400f8c6103fa08532dd33ef4cc714faa994.zip |
Changed poll()/select()/epoll monitoring logic:
connections monitored for incoming data only when expecting any incoming data;
connections always monitored for disconnection and out-of-band data;
connections are closed faster in case of any error conditions;
fixed non-zero timeout in poll() mode with MHD_EVENT_LOOP_INFO_BLOCK connections.
Diffstat (limited to 'src/microhttpd/mhd_sockets.h')
-rw-r--r-- | src/microhttpd/mhd_sockets.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h index d160dbcd..6b3261c3 100644 --- a/src/microhttpd/mhd_sockets.h +++ b/src/microhttpd/mhd_sockets.h | |||
@@ -339,6 +339,36 @@ | |||
339 | # else /* MHD_WINSOCK_SOCKETS */ | 339 | # else /* MHD_WINSOCK_SOCKETS */ |
340 | # define MHD_sys_poll_ WSAPoll | 340 | # define MHD_sys_poll_ WSAPoll |
341 | # endif /* MHD_WINSOCK_SOCKETS */ | 341 | # endif /* MHD_WINSOCK_SOCKETS */ |
342 | |||
343 | # ifdef POLLPRI | ||
344 | # define MHD_POLLPRI_OR_ZERO POLLPRI | ||
345 | # else /* ! POLLPRI */ | ||
346 | # define MHD_POLLPRI_OR_ZERO 0 | ||
347 | # endif /* ! POLLPRI */ | ||
348 | # ifdef POLLRDBAND | ||
349 | # define MHD_POLLRDBAND_OR_ZERO POLLRDBAND | ||
350 | # else /* ! POLLRDBAND */ | ||
351 | # define MHD_POLLRDBAND_OR_ZERO 0 | ||
352 | # endif /* ! POLLRDBAND */ | ||
353 | # ifdef POLLNVAL | ||
354 | # define MHD_POLLNVAL_OR_ZERO POLLNVAL | ||
355 | # else /* ! POLLNVAL */ | ||
356 | # define MHD_POLLNVAL_OR_ZERO 0 | ||
357 | # endif /* ! POLLNVAL */ | ||
358 | |||
359 | /* MHD_POLL_EVENTS_ERR_DISC is 'events' mask for errors and disconnect. | ||
360 | * Note: Out-of-band data is treated as error. */ | ||
361 | # if defined(_WIN32) | ||
362 | # define MHD_POLL_EVENTS_ERR_DISC POLLRDBAND | ||
363 | # elif defined(__linux__) | ||
364 | # define MHD_POLL_EVENTS_ERR_DISC POLLPRI | ||
365 | # else /* ! __linux__ */ | ||
366 | # define MHD_POLL_EVENTS_ERR_DISC (MHD_POLLPRI_OR_ZERO | MHD_POLLRDBAND_OR_ZERO) | ||
367 | # endif /* ! __linux__ */ | ||
368 | /* MHD_POLL_REVENTS_ERR_DISC is 'revents' mask for errors and disconnect. | ||
369 | * Note: Out-of-band data is treated as error. */ | ||
370 | # define MHD_POLL_REVENTS_ERR_DISC \ | ||
371 | (MHD_POLLPRI_OR_ZERO | MHD_POLLRDBAND_OR_ZERO | MHD_POLLNVAL_OR_ZERO | POLLERR | POLLHUP) | ||
342 | #endif /* HAVE_POLL */ | 372 | #endif /* HAVE_POLL */ |
343 | 373 | ||
344 | #define MHD_SCKT_MISSING_ERR_CODE_ 31450 | 374 | #define MHD_SCKT_MISSING_ERR_CODE_ 31450 |