diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-04-23 16:16:01 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-04-23 16:16:01 +0000 |
commit | 8bb4ce7621be4e6bcd4bcdc7513b7c94fcded3b4 (patch) | |
tree | 803cedfca858fab6b42bc903a54e9797a9217e1f /src | |
parent | 32d09c83915ca7cab0890cdc246fc3bd63a2a97b (diff) | |
download | libmicrohttpd-8bb4ce7621be4e6bcd4bcdc7513b7c94fcded3b4.tar.gz libmicrohttpd-8bb4ce7621be4e6bcd4bcdc7513b7c94fcded3b4.zip |
test_quiesce: added more checks and more error reports
Diffstat (limited to 'src')
-rw-r--r-- | src/testcurl/test_quiesce.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c index 8ce09434..aedcf760 100644 --- a/src/testcurl/test_quiesce.c +++ b/src/testcurl/test_quiesce.c | |||
@@ -152,7 +152,7 @@ ServeOneRequest(void *param) | |||
152 | } | 152 | } |
153 | MHD_stop_daemon (d); | 153 | MHD_stop_daemon (d); |
154 | MHD_socket_close_(fd); | 154 | MHD_socket_close_(fd); |
155 | return NULL; | 155 | return done ? NULL : "Requests was not served by ServeOneRequest()"; |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
@@ -229,6 +229,14 @@ testGet (int type, int pool_count, int poll_flag) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | fd = MHD_quiesce_daemon (d); | 231 | fd = MHD_quiesce_daemon (d); |
232 | if (MHD_INVALID_SOCKET == fd) | ||
233 | { | ||
234 | fprintf (stderr, | ||
235 | "MHD_quiesce_daemon failed.\n"); | ||
236 | curl_easy_cleanup (c); | ||
237 | MHD_stop_daemon (d); | ||
238 | return 2; | ||
239 | } | ||
232 | if (0 != pthread_create(&thrd, NULL, &ServeOneRequest, (void*)(intptr_t) fd)) | 240 | if (0 != pthread_create(&thrd, NULL, &ServeOneRequest, (void*)(intptr_t) fd)) |
233 | { | 241 | { |
234 | fprintf (stderr, "pthread_create failed\n"); | 242 | fprintf (stderr, "pthread_create failed\n"); |
@@ -411,8 +419,16 @@ testExternalGet () | |||
411 | if (i == 0) { | 419 | if (i == 0) { |
412 | /* quiesce the daemon on the 1st iteration, so the 2nd should fail */ | 420 | /* quiesce the daemon on the 1st iteration, so the 2nd should fail */ |
413 | fd = MHD_quiesce_daemon(d); | 421 | fd = MHD_quiesce_daemon(d); |
414 | if (MHD_INVALID_SOCKET == fd) | 422 | if (MHD_INVALID_SOCKET == fd) |
415 | abort (); | 423 | { |
424 | fprintf (stderr, | ||
425 | "MHD_quiesce_daemon failed.\n"); | ||
426 | curl_multi_remove_handle (multi, c); | ||
427 | curl_multi_cleanup (multi); | ||
428 | curl_easy_cleanup (c); | ||
429 | MHD_stop_daemon (d); | ||
430 | return 2; | ||
431 | } | ||
416 | MHD_socket_close_ (fd); | 432 | MHD_socket_close_ (fd); |
417 | c = setupCURL (&cbc); | 433 | c = setupCURL (&cbc); |
418 | multi = curl_multi_init (); | 434 | multi = curl_multi_init (); |