[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5047 - libmicrohttpd/src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5047 - libmicrohttpd/src/daemon |
Date: |
Wed, 13 Jun 2007 18:26:06 -0600 (MDT) |
Author: grothoff
Date: 2007-06-13 18:26:06 -0600 (Wed, 13 Jun 2007)
New Revision: 5047
Modified:
libmicrohttpd/src/daemon/daemon.c
libmicrohttpd/src/daemon/daemontest1.c
libmicrohttpd/src/daemon/response.c
libmicrohttpd/src/daemon/session.c
Log:
fixes
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2007-06-14 00:09:32 UTC (rev 5046)
+++ libmicrohttpd/src/daemon/daemon.c 2007-06-14 00:26:06 UTC (rev 5047)
@@ -276,6 +276,7 @@
struct MHD_Session * pos;
struct MHD_Session * prev;
struct MHD_HTTP_Header * hpos;
+ void * unused;
pos = daemon->connections;
prev = NULL;
@@ -285,6 +286,8 @@
daemon->connections = pos->next;
else
prev->next = pos->next;
+ if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
+ pthread_join(pos->pid, &unused);
free(pos->addr);
if (pos->url != NULL)
free(pos->url);
@@ -299,6 +302,7 @@
pos->headers_received = hpos->next;
free(hpos->header);
free(hpos->value);
+ free(hpos);
}
if (pos->response != NULL)
MHD_destroy_response(pos->response);
@@ -337,6 +341,7 @@
fd_set es;
int max;
struct timeval timeout;
+ int ds;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
@@ -373,16 +378,22 @@
strerror(errno));
return MHD_NO;
}
- if (FD_ISSET(daemon->socket_fd,
+ ds = daemon->socket_fd;
+ if (ds == -1)
+ return MHD_YES;
+ if (FD_ISSET(ds,
&rs))
MHD_accept_connection(daemon);
if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) {
/* do not have a thread per connection, process all connections now */
pos = daemon->connections;
while (pos != NULL) {
- if (FD_ISSET(pos->socket_fd, &rs))
+ ds = pos->socket_fd;
+ if (ds == -1)
+ continue;
+ if (FD_ISSET(ds, &rs))
MHD_session_handle_read(pos);
- if (FD_ISSET(pos->socket_fd, &ws))
+ if (FD_ISSET(ds, &ws))
MHD_session_handle_write(pos);
pos = pos->next;
}
@@ -542,9 +553,6 @@
close(daemon->connections->socket_fd);
daemon->connections->socket_fd = -1;
}
- if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
- pthread_join(daemon->connections->pid, &unused);
-
MHD_cleanup_sessions(daemon);
}
free(daemon);
Modified: libmicrohttpd/src/daemon/daemontest1.c
===================================================================
--- libmicrohttpd/src/daemon/daemontest1.c 2007-06-14 00:09:32 UTC (rev
5046)
+++ libmicrohttpd/src/daemon/daemontest1.c 2007-06-14 00:26:06 UTC (rev
5047)
@@ -131,14 +131,14 @@
return 2;
}
curl_easy_cleanup(c);
- if (cbc.pos != strlen("hello_world")) {
+ if (cbc.pos != strlen("/hello_world")) {
MHD_stop_daemon(d);
return 4;
}
- if (0 != strncmp("hello_world",
+ if (0 != strncmp("/hello_world",
cbc.buf,
- strlen("hello_world"))) {
+ strlen("/hello_world"))) {
MHD_stop_daemon(d);
return 8;
}
@@ -190,16 +190,18 @@
curl_easy_setopt(c,
CURLOPT_NOSIGNAL,
1);
- if (CURLE_OK != curl_easy_perform(c))
+ if (CURLE_OK != curl_easy_perform(c)) {
+ MHD_stop_daemon(d);
return 32;
+ }
curl_easy_cleanup(c);
- if (cbc.pos != strlen("hello_world")) {
+ if (cbc.pos != strlen("/hello_world")) {
MHD_stop_daemon(d);
return 64;
}
- if (0 != strncmp("hello_world",
+ if (0 != strncmp("/hello_world",
cbc.buf,
- strlen("hello_world"))) {
+ strlen("/hello_world"))) {
MHD_stop_daemon(d);
return 128;
}
Modified: libmicrohttpd/src/daemon/response.c
===================================================================
--- libmicrohttpd/src/daemon/response.c 2007-06-14 00:09:32 UTC (rev 5046)
+++ libmicrohttpd/src/daemon/response.c 2007-06-14 00:26:06 UTC (rev 5047)
@@ -250,6 +250,8 @@
}
pthread_mutex_unlock(&response->mutex);
pthread_mutex_destroy(&response->mutex);
+ if (response->crfc != NULL)
+ response->crfc(response->crc_cls);
while (response->first_header != NULL) {
pos = response->first_header;
response->first_header = pos->next;
Modified: libmicrohttpd/src/daemon/session.c
===================================================================
--- libmicrohttpd/src/daemon/session.c 2007-06-14 00:09:32 UTC (rev 5046)
+++ libmicrohttpd/src/daemon/session.c 2007-06-14 00:26:06 UTC (rev 5047)
@@ -275,8 +275,6 @@
session->headers_received = hdr;
}
/* FIXME: here: find cookie header and parse that! */
- if (session->bodyReceived == 0)
- return;
return;
DIE:
close(session->socket_fd);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5047 - libmicrohttpd/src/daemon,
gnunet <=