diff options
Diffstat (limited to 'src/testcurl/daemontest_get.c')
-rw-r--r-- | src/testcurl/daemontest_get.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/testcurl/daemontest_get.c b/src/testcurl/daemontest_get.c index c8e47cd5..ffcbbf90 100644 --- a/src/testcurl/daemontest_get.c +++ b/src/testcurl/daemontest_get.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007, 2009 Christian Grothoff | 3 | (C) 2007, 2009, 2011 Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -97,7 +97,7 @@ ahc_echo (void *cls, | |||
97 | 97 | ||
98 | 98 | ||
99 | static int | 99 | static int |
100 | testInternalGet () | 100 | testInternalGet (int poll_flag) |
101 | { | 101 | { |
102 | struct MHD_Daemon *d; | 102 | struct MHD_Daemon *d; |
103 | CURL *c; | 103 | CURL *c; |
@@ -108,7 +108,7 @@ testInternalGet () | |||
108 | cbc.buf = buf; | 108 | cbc.buf = buf; |
109 | cbc.size = 2048; | 109 | cbc.size = 2048; |
110 | cbc.pos = 0; | 110 | cbc.pos = 0; |
111 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, | 111 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, |
112 | 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 112 | 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
113 | if (d == NULL) | 113 | if (d == NULL) |
114 | return 1; | 114 | return 1; |
@@ -146,7 +146,7 @@ testInternalGet () | |||
146 | } | 146 | } |
147 | 147 | ||
148 | static int | 148 | static int |
149 | testMultithreadedGet () | 149 | testMultithreadedGet (int poll_flag) |
150 | { | 150 | { |
151 | struct MHD_Daemon *d; | 151 | struct MHD_Daemon *d; |
152 | CURL *c; | 152 | CURL *c; |
@@ -157,7 +157,7 @@ testMultithreadedGet () | |||
157 | cbc.buf = buf; | 157 | cbc.buf = buf; |
158 | cbc.size = 2048; | 158 | cbc.size = 2048; |
159 | cbc.pos = 0; | 159 | cbc.pos = 0; |
160 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, | 160 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, |
161 | 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 161 | 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
162 | if (d == NULL) | 162 | if (d == NULL) |
163 | return 16; | 163 | return 16; |
@@ -195,7 +195,7 @@ testMultithreadedGet () | |||
195 | } | 195 | } |
196 | 196 | ||
197 | static int | 197 | static int |
198 | testMultithreadedPoolGet () | 198 | testMultithreadedPoolGet (int poll_flag) |
199 | { | 199 | { |
200 | struct MHD_Daemon *d; | 200 | struct MHD_Daemon *d; |
201 | CURL *c; | 201 | CURL *c; |
@@ -206,7 +206,7 @@ testMultithreadedPoolGet () | |||
206 | cbc.buf = buf; | 206 | cbc.buf = buf; |
207 | cbc.size = 2048; | 207 | cbc.size = 2048; |
208 | cbc.pos = 0; | 208 | cbc.pos = 0; |
209 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, | 209 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, |
210 | 1081, NULL, NULL, &ahc_echo, "GET", | 210 | 1081, NULL, NULL, &ahc_echo, "GET", |
211 | MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END); | 211 | MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END); |
212 | if (d == NULL) | 212 | if (d == NULL) |
@@ -367,7 +367,7 @@ testExternalGet () | |||
367 | } | 367 | } |
368 | 368 | ||
369 | static int | 369 | static int |
370 | testUnknownPortGet () | 370 | testUnknownPortGet (int poll_flag) |
371 | { | 371 | { |
372 | struct MHD_Daemon *d; | 372 | struct MHD_Daemon *d; |
373 | const union MHD_DaemonInfo *di; | 373 | const union MHD_DaemonInfo *di; |
@@ -386,7 +386,7 @@ testUnknownPortGet () | |||
386 | cbc.buf = buf; | 386 | cbc.buf = buf; |
387 | cbc.size = 2048; | 387 | cbc.size = 2048; |
388 | cbc.pos = 0; | 388 | cbc.pos = 0; |
389 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, | 389 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, |
390 | 1, NULL, NULL, &ahc_echo, "GET", | 390 | 1, NULL, NULL, &ahc_echo, "GET", |
391 | MHD_OPTION_SOCK_ADDR, &addr, | 391 | MHD_OPTION_SOCK_ADDR, &addr, |
392 | MHD_OPTION_END); | 392 | MHD_OPTION_END); |
@@ -441,13 +441,13 @@ testUnknownPortGet () | |||
441 | 441 | ||
442 | 442 | ||
443 | static int | 443 | static int |
444 | testStopRace () | 444 | testStopRace (int poll_flag) |
445 | { | 445 | { |
446 | struct sockaddr_in sin; | 446 | struct sockaddr_in sin; |
447 | int fd; | 447 | int fd; |
448 | struct MHD_Daemon *d; | 448 | struct MHD_Daemon *d; |
449 | 449 | ||
450 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, | 450 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, |
451 | 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 451 | 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
452 | if (d == NULL) | 452 | if (d == NULL) |
453 | return 16; | 453 | return 16; |
@@ -493,12 +493,17 @@ main (int argc, char *const *argv) | |||
493 | oneone = NULL != strstr (argv[0], "11"); | 493 | oneone = NULL != strstr (argv[0], "11"); |
494 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) | 494 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) |
495 | return 2; | 495 | return 2; |
496 | errorCount += testInternalGet (); | 496 | errorCount += testInternalGet (0); |
497 | errorCount += testMultithreadedGet (); | 497 | errorCount += testMultithreadedGet (0); |
498 | errorCount += testMultithreadedPoolGet (); | 498 | errorCount += testMultithreadedPoolGet (0); |
499 | errorCount += testUnknownPortGet (0); | ||
500 | errorCount += testStopRace (0); | ||
499 | errorCount += testExternalGet (); | 501 | errorCount += testExternalGet (); |
500 | errorCount += testUnknownPortGet (); | 502 | errorCount += testInternalGet (MHD_USE_POLL); |
501 | errorCount += testStopRace (); | 503 | errorCount += testMultithreadedGet (MHD_USE_POLL); |
504 | errorCount += testMultithreadedPoolGet (MHD_USE_POLL); | ||
505 | errorCount += testUnknownPortGet (MHD_USE_POLL); | ||
506 | errorCount += testStopRace (MHD_USE_POLL); | ||
502 | if (errorCount != 0) | 507 | if (errorCount != 0) |
503 | fprintf (stderr, "Error (code: %u)\n", errorCount); | 508 | fprintf (stderr, "Error (code: %u)\n", errorCount); |
504 | curl_global_cleanup (); | 509 | curl_global_cleanup (); |