From 4e9325e8dc019fb915c8d39e2199f339ed7e038d Mon Sep 17 00:00:00 2001 From: zeliard Date: Fri, 5 Jun 2015 16:39:26 +0900 Subject: [PATCH 1/2] *fix: bench_httpclient to support win32 --- test/bench_httpclient.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/bench_httpclient.c b/test/bench_httpclient.c index 22f174da..8700754f 100644 --- a/test/bench_httpclient.c +++ b/test/bench_httpclient.c @@ -152,6 +152,9 @@ launch_request(void) frob_socket(sock); if (connect(sock, (struct sockaddr*)&sin, sizeof(sin)) < 0) { int e = errno; +#ifdef _WIN32 + e = WSAGetLastError(); +#endif if (! EVUTIL_ERR_CONNECT_RETRIABLE(e)) { evutil_closesocket(sock); return -1; @@ -183,6 +186,11 @@ main(int argc, char **argv) double throughput; resource = "/ref"; +#ifdef _WIN32 + WSADATA WSAData; + WSAStartup(0x101, &WSAData); +#endif + setvbuf(stdout, NULL, _IONBF, 0); base = event_base_new(); @@ -226,5 +234,9 @@ main(int argc, char **argv) (double)(usec/1000) / total_n_handled, (I64_TYP)total_n_bytes, n_errors); +#ifdef _WIN32 + WSACleanup(); +#endif + return 0; } From cb969312361666553b170605f30b11479845e78b Mon Sep 17 00:00:00 2001 From: Seungmo Koo Date: Sun, 7 Jun 2015 15:51:15 +0900 Subject: [PATCH 2/2] Update bench_httpclient.c *fixed: socket_geterror instead of WSAGetLastError --- test/bench_httpclient.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/bench_httpclient.c b/test/bench_httpclient.c index 8700754f..bcddc95f 100644 --- a/test/bench_httpclient.c +++ b/test/bench_httpclient.c @@ -151,10 +151,7 @@ launch_request(void) } frob_socket(sock); if (connect(sock, (struct sockaddr*)&sin, sizeof(sin)) < 0) { - int e = errno; -#ifdef _WIN32 - e = WSAGetLastError(); -#endif + int e = evutil_socket_geterror(sock); if (! EVUTIL_ERR_CONNECT_RETRIABLE(e)) { evutil_closesocket(sock); return -1;