mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Merge pull request #254 from zeliard/master
Fix bench_httpclient to support win32
This commit is contained in:
commit
109b03f402
@ -151,7 +151,7 @@ launch_request(void)
|
||||
}
|
||||
frob_socket(sock);
|
||||
if (connect(sock, (struct sockaddr*)&sin, sizeof(sin)) < 0) {
|
||||
int e = errno;
|
||||
int e = evutil_socket_geterror(sock);
|
||||
if (! EVUTIL_ERR_CONNECT_RETRIABLE(e)) {
|
||||
evutil_closesocket(sock);
|
||||
return -1;
|
||||
@ -183,6 +183,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 +231,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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user