From d49a65879f16362c2d37815a89942ff1ba218c6c Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Thu, 24 Mar 2016 20:29:25 +0300 Subject: [PATCH] test/http: fix SERVER_TIMEOUT tests under win32 Seems that the hack with filling BACKLOG didn't work on win32, and hence we stuck in write() waiting, not in connect() And: $ time regress http/cancel_server_timeout - on linux: 10secs - on win32: 2-5secs I tried to debug this but you can't sniff TCP packages (wireshark/rawpcap) on localhost in windows xp (according to [RAWPCAP] and my testing). RAWPCAP: http://www.netresec.com/?page=RawCap --- test/regress_http.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/regress_http.c b/test/regress_http.c index 06d936c1..cc0bb1bb 100644 --- a/test/regress_http.c +++ b/test/regress_http.c @@ -1275,6 +1275,7 @@ http_failed_request_done(struct evhttp_request *req, void *arg) end: event_base_loopexit(arg, NULL); } +#ifndef _WIN32 static void http_timed_out_request_done(struct evhttp_request *req, void *arg) { @@ -1283,6 +1284,7 @@ http_timed_out_request_done(struct evhttp_request *req, void *arg) end: event_base_loopexit(arg, NULL); } +#endif static void http_request_error_cb_with_cancel(enum evhttp_request_error error, void *arg) @@ -1366,9 +1368,12 @@ static struct evhttp_request * http_cancel_test_bad_request_new(enum http_cancel_test_type type, struct event_base *base) { +#ifndef _WIN32 if (!(type & NO_NS) && (type & SERVER_TIMEOUT)) return evhttp_request_new(http_timed_out_request_done, base); - else if ((type & INACTIVE_SERVER) || (type & NO_NS)) + else +#endif + if ((type & INACTIVE_SERVER) || (type & NO_NS)) return evhttp_request_new(http_failed_request_done, base); else return NULL;