diff --git a/third_party/libevent/buffer.c b/third_party/libevent/buffer.c index 64324bb..ebf35c9 100644 --- a/third_party/libevent/buffer.c +++ b/third_party/libevent/buffer.c @@ -356,7 +356,6 @@ int evbuffer_expand(struct evbuffer *buf, size_t datlen) { size_t used = buf->misalign + buf->off; - size_t need; assert(buf->totallen >= used); diff --git a/third_party/libevent/evdns.c b/third_party/libevent/evdns.c index fa23163..f1c70d0 100644 --- a/third_party/libevent/evdns.c +++ b/third_party/libevent/evdns.c @@ -134,7 +134,7 @@ typedef ev_uint8_t u_char; typedef unsigned int uint; #endif -#include +#include "event.h" #define u64 ev_uint64_t #define u32 ev_uint32_t diff --git a/third_party/libevent/evdns.h b/third_party/libevent/evdns.h index 1eb5c38..fca4ac3 100644 --- a/third_party/libevent/evdns.h +++ b/third_party/libevent/evdns.h @@ -165,7 +165,7 @@ extern "C" { #endif /* For integer types. */ -#include +#include "evutil.h" /** Error codes 0-5 are as described in RFC 1035. */ #define DNS_ERR_NONE 0 diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c index da6cd42..36b1c51 100644 --- a/third_party/libevent/event.c +++ b/third_party/libevent/event.c @@ -107,7 +107,7 @@ static const struct eventop *eventops[] = { /* Global state */ struct event_base *current_base = NULL; extern struct event_base *evsignal_base; -static int use_monotonic; +static int use_monotonic = 1; /* Handle signals - This is a deprecated interface */ int (*event_sigcb)(void); /* Signal callback when gotsig is set */ @@ -124,17 +124,6 @@ static int timeout_next(struct event_base *, struct timeval **); static void timeout_process(struct event_base *); static void timeout_correct(struct event_base *, struct timeval *); -static void -detect_monotonic(void) -{ -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) - struct timespec ts; - - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) - use_monotonic = 1; -#endif -} - static int gettime(struct event_base *base, struct timeval *tp) { @@ -144,18 +133,18 @@ gettime(struct event_base *base, struct timeval *tp) } #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) - if (use_monotonic) { - struct timespec ts; - - if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) - return (-1); + struct timespec ts; + if (use_monotonic && + clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { tp->tv_sec = ts.tv_sec; tp->tv_usec = ts.tv_nsec / 1000; return (0); } #endif + use_monotonic = 0; + return (evutil_gettimeofday(tp, NULL)); } @@ -182,7 +171,6 @@ event_base_new(void) event_sigcb = NULL; event_gotsig = 0; - detect_monotonic(); gettime(base, &base->event_tv); min_heap_ctor(&base->timeheap); @@ -398,12 +386,9 @@ event_process_active(struct event_base *base) ncalls--; ev->ev_ncalls = ncalls; (*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg); - if (event_gotsig || base->event_break) { - ev->ev_pncalls = NULL; + if (event_gotsig || base->event_break) return; - } } - ev->ev_pncalls = NULL; } } @@ -808,8 +793,6 @@ int event_del(struct event *ev) { struct event_base *base; - const struct eventop *evsel; - void *evbase; event_debug(("event_del: %p, callback %p", ev, ev->ev_callback)); @@ -819,8 +802,6 @@ event_del(struct event *ev) return (-1); base = ev->ev_base; - evsel = base->evsel; - evbase = base->evbase; assert(!(ev->ev_flags & ~EVLIST_ALL)); @@ -838,7 +819,7 @@ event_del(struct event *ev) if (ev->ev_flags & EVLIST_INSERTED) { event_queue_remove(base, ev, EVLIST_INSERTED); - return (evsel->del(evbase, ev)); + return (base->evsel->del(base->evbase, ev)); } return (0); diff --git a/third_party/libevent/event.h b/third_party/libevent/event.h index d1f5d9e..f0887b9 100644 --- a/third_party/libevent/event.h +++ b/third_party/libevent/event.h @@ -159,7 +159,7 @@ extern "C" { #endif -#include +#include "event-config.h" #ifdef _EVENT_HAVE_SYS_TYPES_H #include #endif @@ -172,7 +172,7 @@ extern "C" { #include /* For int types. */ -#include +#include "evutil.h" #ifdef WIN32 #define WIN32_LEAN_AND_MEAN diff --git a/third_party/libevent/evhttp.h b/third_party/libevent/evhttp.h index cba8be1..48c1d91 100644 --- a/third_party/libevent/evhttp.h +++ b/third_party/libevent/evhttp.h @@ -27,7 +27,7 @@ #ifndef _EVHTTP_H_ #define _EVHTTP_H_ -#include +#include "event.h" #ifdef __cplusplus extern "C" { diff --git a/third_party/libevent/evutil.h b/third_party/libevent/evutil.h index dcb0013..8b664b9 100644 --- a/third_party/libevent/evutil.h +++ b/third_party/libevent/evutil.h @@ -38,7 +38,7 @@ extern "C" { #endif -#include +#include "event-config.h" #ifdef _EVENT_HAVE_SYS_TIME_H #include #endif