diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 283c8c45..5646fcfb 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -819,6 +819,9 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
819 | fd_setsize)) ) | 819 | fd_setsize)) ) |
820 | result = MHD_NO; | 820 | result = MHD_NO; |
821 | 821 | ||
822 | /* Add all sockets to 'except_fd_set' as well to watch for | ||
823 | * out-of-band data. However, ignore errors if INFO_READ | ||
824 | * or INFO_WRITE sockets will not fit 'except_fd_set'. */ | ||
822 | /* Start from oldest connections. Make sense for W32 FDSETs. */ | 825 | /* Start from oldest connections. Make sense for W32 FDSETs. */ |
823 | for (pos = daemon->connections_tail; NULL != pos; pos = posn) | 826 | for (pos = daemon->connections_tail; NULL != pos; pos = posn) |
824 | { | 827 | { |
@@ -832,6 +835,12 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
832 | max_fd, | 835 | max_fd, |
833 | fd_setsize)) | 836 | fd_setsize)) |
834 | result = MHD_NO; | 837 | result = MHD_NO; |
838 | #ifdef MHD_POSIX_SOCKETS | ||
839 | MHD_add_to_fd_set_ (pos->socket_fd, | ||
840 | except_fd_set, | ||
841 | max_fd, | ||
842 | fd_setsize); | ||
843 | #endif /* MHD_POSIX_SOCKETS */ | ||
835 | break; | 844 | break; |
836 | case MHD_EVENT_LOOP_INFO_WRITE: | 845 | case MHD_EVENT_LOOP_INFO_WRITE: |
837 | if (! MHD_add_to_fd_set_ (pos->socket_fd, | 846 | if (! MHD_add_to_fd_set_ (pos->socket_fd, |
@@ -839,6 +848,12 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
839 | max_fd, | 848 | max_fd, |
840 | fd_setsize)) | 849 | fd_setsize)) |
841 | result = MHD_NO; | 850 | result = MHD_NO; |
851 | #ifdef MHD_POSIX_SOCKETS | ||
852 | MHD_add_to_fd_set_ (pos->socket_fd, | ||
853 | except_fd_set, | ||
854 | max_fd, | ||
855 | fd_setsize); | ||
856 | #endif /* MHD_POSIX_SOCKETS */ | ||
842 | break; | 857 | break; |
843 | case MHD_EVENT_LOOP_INFO_BLOCK: | 858 | case MHD_EVENT_LOOP_INFO_BLOCK: |
844 | if ( (NULL == except_fd_set) || | 859 | if ( (NULL == except_fd_set) || |
@@ -853,6 +868,19 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
853 | break; | 868 | break; |
854 | } | 869 | } |
855 | } | 870 | } |
871 | #ifdef MHD_WINSOCK_SOCKETS | ||
872 | /* W32 use limited array for fd_set so add INFO_READ/INFO_WRITE sockets | ||
873 | * only after INFO_BLOCK sockets to ensure that INFO_BLOCK sockets will | ||
874 | * not be pushed out. */ | ||
875 | for (pos = daemon->connections_tail; NULL != pos; pos = posn) | ||
876 | { | ||
877 | posn = pos->prev; | ||
878 | MHD_add_to_fd_set_ (pos->socket_fd, | ||
879 | except_fd_set, | ||
880 | max_fd, | ||
881 | fd_setsize); | ||
882 | } | ||
883 | #endif /* MHD_WINSOCK_SOCKETS */ | ||
856 | #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) | 884 | #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) |
857 | { | 885 | { |
858 | struct MHD_UpgradeResponseHandle *urh; | 886 | struct MHD_UpgradeResponseHandle *urh; |