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
This commit is contained in:
Azat Khuzhin 2016-03-24 20:29:25 +03:00
parent 376f107318
commit d49a65879f

View File

@ -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;