diff options
Diffstat (limited to 'src/microhttpd/test_daemon.c')
-rw-r--r-- | src/microhttpd/test_daemon.c | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c index af59b86d..4f600ef0 100644 --- a/src/microhttpd/test_daemon.c +++ b/src/microhttpd/test_daemon.c | |||
@@ -57,7 +57,7 @@ apc_nothing (void *cls, | |||
57 | const struct sockaddr *addr, | 57 | const struct sockaddr *addr, |
58 | socklen_t addrlen) | 58 | socklen_t addrlen) |
59 | { | 59 | { |
60 | (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */ | 60 | (void) cls; (void) addr; (void) addrlen; /* Unused. Silent compiler warning. */ |
61 | 61 | ||
62 | return MHD_NO; | 62 | return MHD_NO; |
63 | } | 63 | } |
@@ -68,7 +68,7 @@ apc_all (void *cls, | |||
68 | const struct sockaddr *addr, | 68 | const struct sockaddr *addr, |
69 | socklen_t addrlen) | 69 | socklen_t addrlen) |
70 | { | 70 | { |
71 | (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */ | 71 | (void) cls; (void) addr; (void) addrlen; /* Unused. Silent compiler warning. */ |
72 | 72 | ||
73 | return MHD_YES; | 73 | return MHD_YES; |
74 | } | 74 | } |
@@ -83,9 +83,9 @@ ahc_nothing (void *cls, | |||
83 | const char *upload_data, size_t *upload_data_size, | 83 | const char *upload_data, size_t *upload_data_size, |
84 | void **unused) | 84 | void **unused) |
85 | { | 85 | { |
86 | (void)cls;(void)connection;(void)url; /* Unused. Silent compiler warning. */ | 86 | (void) cls; (void) connection; (void) url; /* Unused. Silent compiler warning. */ |
87 | (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ | 87 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
88 | (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ | 88 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ |
89 | 89 | ||
90 | return MHD_NO; | 90 | return MHD_NO; |
91 | } | 91 | } |
@@ -136,25 +136,25 @@ testExternalRun () | |||
136 | } | 136 | } |
137 | i = 0; | 137 | i = 0; |
138 | while (i < 15) | 138 | while (i < 15) |
139 | { | ||
140 | maxfd = 0; | ||
141 | FD_ZERO (&rs); | ||
142 | if (MHD_YES != MHD_get_fdset (d, &rs, &rs, &rs, &maxfd)) | ||
143 | { | ||
144 | MHD_stop_daemon (d); | ||
145 | fprintf (stderr, | ||
146 | "Failed in MHD_get_fdset()\n"); | ||
147 | return 256; | ||
148 | } | ||
149 | if (MHD_run (d) == MHD_NO) | ||
139 | { | 150 | { |
140 | maxfd = 0; | 151 | MHD_stop_daemon (d); |
141 | FD_ZERO (&rs); | 152 | fprintf (stderr, |
142 | if (MHD_YES != MHD_get_fdset (d, &rs, &rs, &rs, &maxfd)) | 153 | "Failed in MHD_run()\n"); |
143 | { | 154 | return 8; |
144 | MHD_stop_daemon (d); | ||
145 | fprintf (stderr, | ||
146 | "Failed in MHD_get_fdset()\n"); | ||
147 | return 256; | ||
148 | } | ||
149 | if (MHD_run (d) == MHD_NO) | ||
150 | { | ||
151 | MHD_stop_daemon (d); | ||
152 | fprintf (stderr, | ||
153 | "Failed in MHD_run()\n"); | ||
154 | return 8; | ||
155 | } | ||
156 | i++; | ||
157 | } | 155 | } |
156 | i++; | ||
157 | } | ||
158 | MHD_stop_daemon (d); | 158 | MHD_stop_daemon (d); |
159 | return 0; | 159 | return 0; |
160 | } | 160 | } |
@@ -179,11 +179,11 @@ testThread () | |||
179 | exit (77); | 179 | exit (77); |
180 | } | 180 | } |
181 | if (MHD_run (d) != MHD_NO) | 181 | if (MHD_run (d) != MHD_NO) |
182 | { | 182 | { |
183 | fprintf (stderr, | 183 | fprintf (stderr, |
184 | "Failed in MHD_run()\n"); | 184 | "Failed in MHD_run()\n"); |
185 | return 32; | 185 | return 32; |
186 | } | 186 | } |
187 | MHD_stop_daemon (d); | 187 | MHD_stop_daemon (d); |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
@@ -194,7 +194,8 @@ testMultithread () | |||
194 | { | 194 | { |
195 | struct MHD_Daemon *d; | 195 | struct MHD_Daemon *d; |
196 | 196 | ||
197 | d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION, | 197 | d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_INTERNAL_POLLING_THREAD |
198 | | MHD_USE_THREAD_PER_CONNECTION, | ||
198 | 0, | 199 | 0, |
199 | &apc_all, NULL, | 200 | &apc_all, NULL, |
200 | &ahc_nothing, NULL, | 201 | &ahc_nothing, NULL, |
@@ -208,11 +209,11 @@ testMultithread () | |||
208 | exit (77); | 209 | exit (77); |
209 | } | 210 | } |
210 | if (MHD_run (d) != MHD_NO) | 211 | if (MHD_run (d) != MHD_NO) |
211 | { | 212 | { |
212 | fprintf (stderr, | 213 | fprintf (stderr, |
213 | "Failed in MHD_run()\n"); | 214 | "Failed in MHD_run()\n"); |
214 | return 128; | 215 | return 128; |
215 | } | 216 | } |
216 | MHD_stop_daemon (d); | 217 | MHD_stop_daemon (d); |
217 | return 0; | 218 | return 0; |
218 | } | 219 | } |
@@ -223,7 +224,7 @@ main (int argc, | |||
223 | char *const *argv) | 224 | char *const *argv) |
224 | { | 225 | { |
225 | int errorCount = 0; | 226 | int errorCount = 0; |
226 | (void)argc; (void)argv; /* Unused. Silent compiler warning. */ | 227 | (void) argc; (void) argv; /* Unused. Silent compiler warning. */ |
227 | 228 | ||
228 | errorCount += testStartError (); | 229 | errorCount += testStartError (); |
229 | errorCount += testStartStop (); | 230 | errorCount += testStartStop (); |