diff --git a/test/bench_http.c b/test/bench_http.c index 4b2eb3cd..aec5ba07 100644 --- a/test/bench_http.c +++ b/test/bench_http.c @@ -25,8 +25,6 @@ * */ -#include "event2/event-config.h" - #include #include #ifdef WIN32 @@ -44,15 +42,12 @@ #include #include -#include -#include -#include +#include +#include +#include +#include #include -#ifdef WIN32 -#include "iocp-internal.h" -#endif - static void http_basic_cb(struct evhttp_request *req, void *arg); static char *content; @@ -71,8 +66,7 @@ http_basic_cb(struct evhttp_request *req, void *arg) evbuffer_free(evb); } -/* cheasy way of detecting evbuffer_add_reference */ -#ifdef _EVENT2_EVENT_H_ +#if LIBEVENT_VERSION_NUMBER >= 0x02000200 static void http_ref_cb(struct evhttp_request *req, void *arg) { @@ -90,6 +84,7 @@ http_ref_cb(struct evhttp_request *req, void *arg) int main(int argc, char **argv) { + struct event_config *cfg = event_config_new(); struct event_base *base; struct evhttp *http; int i; @@ -105,8 +100,6 @@ main(int argc, char **argv) return (1); #endif - base = event_base_new(); - for (i = 1; i < argc; ++i) { if (*argv[i] != '-') continue; @@ -133,7 +126,7 @@ main(int argc, char **argv) case 'i': use_iocp = 1; evthread_use_windows_threads(); - event_base_start_iocp(base, 0); + event_config_set_flag(cfg,EVENT_BASE_FLAG_STARTUP_IOCP); break; #endif default: @@ -142,6 +135,12 @@ main(int argc, char **argv) } } + base = event_base_new_with_config(cfg); + if (!base) { + fprintf(stderr, "creating event_base failed. Exiting.\n"); + return 1; + } + http = evhttp_new(base); content = malloc(content_len);