[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 01/03: Watch sockets for out-of-band data i
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 01/03: Watch sockets for out-of-band data in select() mode too. This even more unify select() and poll()/epoll modes. |
Date: |
Wed, 01 Mar 2017 21:51:19 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 8314b675e5f7e6e69330c1bcb71a2703e7abc74f
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Wed Mar 1 00:00:34 2017 +0300
Watch sockets for out-of-band data in select() mode too.
This even more unify select() and poll()/epoll modes.
---
src/microhttpd/daemon.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
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,
fd_setsize)) )
result = MHD_NO;
+ /* Add all sockets to 'except_fd_set' as well to watch for
+ * out-of-band data. However, ignore errors if INFO_READ
+ * or INFO_WRITE sockets will not fit 'except_fd_set'. */
/* Start from oldest connections. Make sense for W32 FDSETs. */
for (pos = daemon->connections_tail; NULL != pos; pos = posn)
{
@@ -832,6 +835,12 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
max_fd,
fd_setsize))
result = MHD_NO;
+#ifdef MHD_POSIX_SOCKETS
+ MHD_add_to_fd_set_ (pos->socket_fd,
+ except_fd_set,
+ max_fd,
+ fd_setsize);
+#endif /* MHD_POSIX_SOCKETS */
break;
case MHD_EVENT_LOOP_INFO_WRITE:
if (! MHD_add_to_fd_set_ (pos->socket_fd,
@@ -839,6 +848,12 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
max_fd,
fd_setsize))
result = MHD_NO;
+#ifdef MHD_POSIX_SOCKETS
+ MHD_add_to_fd_set_ (pos->socket_fd,
+ except_fd_set,
+ max_fd,
+ fd_setsize);
+#endif /* MHD_POSIX_SOCKETS */
break;
case MHD_EVENT_LOOP_INFO_BLOCK:
if ( (NULL == except_fd_set) ||
@@ -853,6 +868,19 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
break;
}
}
+#ifdef MHD_WINSOCK_SOCKETS
+ /* W32 use limited array for fd_set so add INFO_READ/INFO_WRITE sockets
+ * only after INFO_BLOCK sockets to ensure that INFO_BLOCK sockets will
+ * not be pushed out. */
+ for (pos = daemon->connections_tail; NULL != pos; pos = posn)
+ {
+ posn = pos->prev;
+ MHD_add_to_fd_set_ (pos->socket_fd,
+ except_fd_set,
+ max_fd,
+ fd_setsize);
+ }
+#endif /* MHD_WINSOCK_SOCKETS */
#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
{
struct MHD_UpgradeResponseHandle *urh;
--
To stop receiving notification emails like this one, please contact
address@hidden