X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libevent%2Ftest%2Fbench_httpclient.c;h=cf6675346422676a9ef0a8d2c532b7ef48dc01b6;hb=3a84db87064922ad10ac10cc1d6833380e575995;hp=19f025f1887244b125c295e82db4e874c856f2a4;hpb=b0bcb8f6b0571592a50ce039882c9319e012a270;p=netatalk.git diff --git a/libevent/test/bench_httpclient.c b/libevent/test/bench_httpclient.c index 19f025f1..cf667534 100644 --- a/libevent/test/bench_httpclient.c +++ b/libevent/test/bench_httpclient.c @@ -1,5 +1,5 @@ /* - * Copyright 2009-2010 Niels Provos and Nick Mathewson + * Copyright 2009-2012 Niels Provos and Nick Mathewson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,8 +31,12 @@ #else #include #include +# ifdef _XOPEN_SOURCE_EXTENDED +# include +# endif #endif #include +#include #include #include "event2/event.h" @@ -84,7 +88,7 @@ errorcb(struct bufferevent *b, short what, void *arg) if (what & BEV_EVENT_EOF) { ++total_n_handled; total_n_bytes += ri->n_read; - gettimeofday(&now, NULL); + evutil_gettimeofday(&now, NULL); evutil_timersub(&now, &ri->started, &diff); evutil_timeradd(&diff, &total_time, &total_time); @@ -127,6 +131,8 @@ launch_request(void) struct request_info *ri; + memset(&sin, 0, sizeof(sin)); + ++total_n_launched; sin.sin_family = AF_INET; @@ -146,7 +152,7 @@ launch_request(void) ri = malloc(sizeof(*ri)); ri->n_read = 0; - gettimeofday(&ri->started, NULL); + evutil_gettimeofday(&ri->started, NULL); b = bufferevent_socket_new(base, sock, BEV_OPT_CLOSE_ON_FREE); @@ -178,11 +184,11 @@ main(int argc, char **argv) perror("launch"); } - gettimeofday(&start, NULL); + evutil_gettimeofday(&start, NULL); event_base_dispatch(base); - gettimeofday(&end, NULL); + evutil_gettimeofday(&end, NULL); evutil_timersub(&end, &start, &total); usec = total_time.tv_sec * 1000000 + total_time.tv_usec;