diff options
Diffstat (limited to 'src/daemon/daemon.c')
-rw-r--r-- | src/daemon/daemon.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index e52ac940..0ebf21d0 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -26,16 +26,6 @@ | |||
26 | * @version 0.1.0 | 26 | * @version 0.1.0 |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <stdio.h> | ||
30 | #include <stdlib.h> | ||
31 | #include <netdb.h> | ||
32 | #include <string.h> | ||
33 | #include <unistd.h> | ||
34 | #include <stdarg> | ||
35 | #include <fcntl.h> | ||
36 | #include <pthread.h> | ||
37 | #include <netinet/in.h> | ||
38 | |||
39 | #include "microhttpd.h" | 29 | #include "microhttpd.h" |
40 | #include "internal.h" | 30 | #include "internal.h" |
41 | #include "response.h" | 31 | #include "response.h" |
@@ -120,10 +110,10 @@ MHD_unregister_handler(struct MHD_Daemon * daemon, | |||
120 | pos = daemon->handlers; | 110 | pos = daemon->handlers; |
121 | prev = NULL; | 111 | prev = NULL; |
122 | while (pos != NULL) { | 112 | while (pos != NULL) { |
123 | if ( (dh == ah->dh) && | 113 | if ( (dh == pos->dh) && |
124 | (dh_cls == ah->dh_cls) && | 114 | (dh_cls == pos->dh_cls) && |
125 | (0 == strcmp(uri_prefix, | 115 | (0 == strcmp(uri_prefix, |
126 | ah->uri_prefix)) ) { | 116 | pos->uri_prefix)) ) { |
127 | if (prev == NULL) | 117 | if (prev == NULL) |
128 | daemon->handlers = pos->next; | 118 | daemon->handlers = pos->next; |
129 | else | 119 | else |
@@ -160,10 +150,10 @@ MHD_get_fdset(struct MHD_Daemon * daemon, | |||
160 | ( (daemon->options & MHD_USE_THREAD_PER_CONNECTION) != 0) ) | 150 | ( (daemon->options & MHD_USE_THREAD_PER_CONNECTION) != 0) ) |
161 | return MHD_NO; | 151 | return MHD_NO; |
162 | FD_SET(daemon->socket_fd, | 152 | FD_SET(daemon->socket_fd, |
163 | &daemon->read_fd_set); | 153 | read_fd_set); |
164 | if ( (*max_fd) < daemon->socket_fd) | 154 | if ( (*max_fd) < daemon->socket_fd) |
165 | *max_fd = daemon->socket_fd; | 155 | *max_fd = daemon->socket_fd; |
166 | pos = daemon->session; | 156 | pos = daemon->connections; |
167 | while (pos != NULL) { | 157 | while (pos != NULL) { |
168 | if (MHD_YES != MHD_session_get_fdset(pos, | 158 | if (MHD_YES != MHD_session_get_fdset(pos, |
169 | read_fd_set, | 159 | read_fd_set, |
@@ -249,7 +239,7 @@ MHD_accept_connection(struct MHD_Daemon * daemon) { | |||
249 | strerror(errno)); | 239 | strerror(errno)); |
250 | return MHD_NO; | 240 | return MHD_NO; |
251 | } | 241 | } |
252 | if (MHD_NO == daemon->apc(mhd->apc_cls, | 242 | if (MHD_NO == daemon->apc(daemon->apc_cls, |
253 | &addr, | 243 | &addr, |
254 | addrlen)) { | 244 | addrlen)) { |
255 | close(s); | 245 | close(s); |
@@ -485,16 +475,14 @@ MHD_start_daemon(unsigned int options, | |||
485 | retVal->port = port; | 475 | retVal->port = port; |
486 | retVal->apc = apc; | 476 | retVal->apc = apc; |
487 | retVal->apc_cls = apc_cls; | 477 | retVal->apc_cls = apc_cls; |
488 | retVal->dh = dh; | ||
489 | retVal->dh_cls = dh_cls; | ||
490 | retVal->socket_fd = socket_fd; | 478 | retVal->socket_fd = socket_fd; |
491 | retVal->default_handler.dh = dh; | 479 | retVal->default_handler.dh = dh; |
492 | retVal->default_handler.dh_cls = dh_cls; | 480 | retVal->default_handler.dh_cls = dh_cls; |
493 | retVal->default_henader.uri_prefix = ""; | 481 | retVal->default_handler.uri_prefix = ""; |
494 | retVal->default_handler.next = NULL; | 482 | retVal->default_handler.next = NULL; |
495 | if ( ( (0 != (options & MHD_USE_THREAD_PER_CONNECTION)) || | 483 | if ( ( (0 != (options & MHD_USE_THREAD_PER_CONNECTION)) || |
496 | (0 != (options & MHD_USE_SELECT_INTERNALLY)) ) && | 484 | (0 != (options & MHD_USE_SELECT_INTERNALLY)) ) && |
497 | (0 != pthread_create(&daemon->pid, | 485 | (0 != pthread_create(&retVal->pid, |
498 | NULL, | 486 | NULL, |
499 | &MHD_select_thread, | 487 | &MHD_select_thread, |
500 | daemon)) ) { | 488 | daemon)) ) { |