diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-09-24 15:13:25 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-09-24 15:13:25 +0300 |
commit | 0c1320721063a811ea76e73559417fdc764bcd9c (patch) | |
tree | ce178bebe2392bdee151c5c3a2469ee5b3e88fa7 /src/testcurl | |
parent | 68452021cb48a6689cdd52fdca434ee10ff76c99 (diff) | |
download | libmicrohttpd-0c1320721063a811ea76e73559417fdc764bcd9c.tar.gz libmicrohttpd-0c1320721063a811ea76e73559417fdc764bcd9c.zip |
test_concurrent_stop: check for client errors
Diffstat (limited to 'src/testcurl')
-rw-r--r-- | src/testcurl/test_concurrent_stop.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/testcurl/test_concurrent_stop.c b/src/testcurl/test_concurrent_stop.c index 845f71f5..842a35c6 100644 --- a/src/testcurl/test_concurrent_stop.c +++ b/src/testcurl/test_concurrent_stop.c | |||
@@ -67,6 +67,11 @@ static volatile int watchdog_continue; | |||
67 | 67 | ||
68 | static const char *watchdog_obj; | 68 | static const char *watchdog_obj; |
69 | 69 | ||
70 | /** | ||
71 | * Indicate that client detected error | ||
72 | */ | ||
73 | static volatile CURLcode client_error; | ||
74 | |||
70 | static void * | 75 | static void * |
71 | thread_watchdog (void *param) | 76 | thread_watchdog (void *param) |
72 | { | 77 | { |
@@ -195,6 +200,7 @@ thread_gets (void *param) | |||
195 | if (CURLE_OK != errornum) | 200 | if (CURLE_OK != errornum) |
196 | { | 201 | { |
197 | curl_easy_cleanup (c); | 202 | curl_easy_cleanup (c); |
203 | client_error = errornum; | ||
198 | return NULL; | 204 | return NULL; |
199 | } | 205 | } |
200 | } | 206 | } |
@@ -258,7 +264,9 @@ testMultithreadedGet (int port, | |||
258 | { | 264 | { |
259 | struct MHD_Daemon *d; | 265 | struct MHD_Daemon *d; |
260 | pthread_t p; | 266 | pthread_t p; |
267 | int result; | ||
261 | 268 | ||
269 | result = 0; | ||
262 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | 270 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
263 | | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | 271 | | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG |
264 | | poll_flag, | 272 | | poll_flag, |
@@ -278,14 +286,21 @@ testMultithreadedGet (int port, | |||
278 | } | 286 | } |
279 | port = (int) dinfo->port; | 287 | port = (int) dinfo->port; |
280 | } | 288 | } |
289 | client_error = CURLE_OK; /* clear client error state */ | ||
281 | p = start_gets (port); | 290 | p = start_gets (port); |
282 | (void) sleep (1); | 291 | (void) sleep (1); |
283 | start_watchdog (10, "daemon_stop() in testMultithreadedGet"); | 292 | start_watchdog (10, "daemon_stop() in testMultithreadedGet"); |
293 | if (CURLE_OK != client_error) /* poor sync, but enough for test */ | ||
294 | { | ||
295 | result = 64; | ||
296 | fprintf (stderr, "libcurl reported at least one error: \"%s\"\n", | ||
297 | curl_easy_strerror (client_error)); | ||
298 | } | ||
284 | MHD_stop_daemon (d); | 299 | MHD_stop_daemon (d); |
285 | stop_watchdog (); | 300 | stop_watchdog (); |
286 | continue_requesting = 0; | 301 | continue_requesting = 0; |
287 | pthread_join (p, NULL); | 302 | pthread_join (p, NULL); |
288 | return 0; | 303 | return result; |
289 | } | 304 | } |
290 | 305 | ||
291 | 306 | ||
@@ -295,7 +310,9 @@ testMultithreadedPoolGet (int port, | |||
295 | { | 310 | { |
296 | struct MHD_Daemon *d; | 311 | struct MHD_Daemon *d; |
297 | pthread_t p; | 312 | pthread_t p; |
313 | int result; | ||
298 | 314 | ||
315 | result = 0; | ||
299 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | 316 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG |
300 | | poll_flag, | 317 | | poll_flag, |
301 | port, | 318 | port, |
@@ -315,14 +332,21 @@ testMultithreadedPoolGet (int port, | |||
315 | } | 332 | } |
316 | port = (int) dinfo->port; | 333 | port = (int) dinfo->port; |
317 | } | 334 | } |
335 | client_error = CURLE_OK; /* clear client error state */ | ||
318 | p = start_gets (port); | 336 | p = start_gets (port); |
319 | (void) sleep (1); | 337 | (void) sleep (1); |
320 | start_watchdog (10, "daemon_stop() in testMultithreadedPoolGet"); | 338 | start_watchdog (10, "daemon_stop() in testMultithreadedPoolGet"); |
339 | if (CURLE_OK != client_error) /* poor sync, but enough for test */ | ||
340 | { | ||
341 | result = 64; | ||
342 | fprintf (stderr, "libcurl reported at least one error: \"%s\"\n", | ||
343 | curl_easy_strerror (client_error)); | ||
344 | } | ||
321 | MHD_stop_daemon (d); | 345 | MHD_stop_daemon (d); |
322 | stop_watchdog (); | 346 | stop_watchdog (); |
323 | continue_requesting = 0; | 347 | continue_requesting = 0; |
324 | pthread_join (p, NULL); | 348 | pthread_join (p, NULL); |
325 | return 0; | 349 | return result; |
326 | } | 350 | } |
327 | 351 | ||
328 | 352 | ||