[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5040 - libmicrohttpd/src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5040 - libmicrohttpd/src/daemon |
Date: |
Wed, 13 Jun 2007 16:16:26 -0600 (MDT) |
Author: grothoff
Date: 2007-06-13 16:16:26 -0600 (Wed, 13 Jun 2007)
New Revision: 5040
Modified:
libmicrohttpd/src/daemon/daemon.c
libmicrohttpd/src/daemon/daemontest.c
Log:
fix
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2007-06-13 22:09:08 UTC (rev 5039)
+++ libmicrohttpd/src/daemon/daemon.c 2007-06-13 22:16:26 UTC (rev 5040)
@@ -319,17 +319,22 @@
/**
* Main select call.
*
+ * @param may_block YES if blocking, NO if non-blocking
* @return MHD_NO on serious errors, MHD_YES on success
*/
static int
-MHD_select(struct MHD_Daemon * daemon) {
+MHD_select(struct MHD_Daemon * daemon,
+ int may_block) {
struct MHD_Session * pos;
int num_ready;
fd_set rs;
fd_set ws;
fd_set es;
int max;
+ struct timeval timeout;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
if(daemon == NULL)
abort();
FD_ZERO(&rs);
@@ -354,7 +359,7 @@
&rs,
&ws,
&es,
- NULL);
+ may_block == MHD_NO ? &timeout : NULL);
if (num_ready < 0) {
if (errno == EINTR)
return MHD_YES;
@@ -397,7 +402,7 @@
(0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ||
(0 != (daemon->options & MHD_USE_SELECT_INTERNALLY)) )
return MHD_NO;
- MHD_select(daemon);
+ MHD_select(daemon, MHD_NO);
MHD_cleanup_sessions(daemon);
return MHD_YES;
}
@@ -411,7 +416,7 @@
MHD_select_thread(void * cls) {
struct MHD_Daemon * daemon = cls;
while (daemon->shutdown == 0) {
- MHD_select(daemon);
+ MHD_select(daemon, MHD_YES);
MHD_cleanup_sessions(daemon);
}
return NULL;
Modified: libmicrohttpd/src/daemon/daemontest.c
===================================================================
--- libmicrohttpd/src/daemon/daemontest.c 2007-06-13 22:09:08 UTC (rev
5039)
+++ libmicrohttpd/src/daemon/daemontest.c 2007-06-13 22:16:26 UTC (rev
5040)
@@ -78,7 +78,7 @@
static int testExternalRun() {
struct MHD_Daemon * d;
- fd_set read;
+ fd_set rs;
int maxfd;
int i;
@@ -93,13 +93,16 @@
return 4;
i = 0;
while(i < 15) {
- MHD_get_fdset(d, &read, &read, &read, &maxfd);
+ maxfd = 0;
+ FD_ZERO(&rs);
+ MHD_get_fdset(d, &rs, &rs, &rs, &maxfd);
if (MHD_run(d) == MHD_NO) {
MHD_stop_daemon(d);
return 8;
}
i++;
}
+ MHD_stop_daemon(d);
return 0;
}
@@ -114,7 +117,7 @@
if (d == NULL)
return 16;
- if (MHD_run(d) == MHD_NO)
+ if (MHD_run(d) != MHD_NO)
return 32;
MHD_stop_daemon(d);
return 0;
@@ -131,8 +134,8 @@
if (d == NULL)
return 64;
- if (MHD_run(d) == MHD_NO)
- return 128;
+ if (MHD_run(d) != MHD_NO)
+ return 128;
MHD_stop_daemon(d);
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5040 - libmicrohttpd/src/daemon,
gnunet <=