From 265e40b481d23ea0ee8b4e1705fb013532d1f6b2 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sun, 3 Jul 2016 19:42:36 +0200 Subject: Raise libevent dependency to 2.0.10-stable or newer Only some very ancient distributions don't ship with Libevent 2 anymore, even the oldest supported Ubuntu LTS version has it. This allows us to get rid of a lot of compat code. --- src/or/config.c | 2 -- src/or/control.c | 4 --- src/or/cpuworker.c | 4 --- src/or/dns.c | 72 +----------------------------------------------------- src/or/dnsserv.c | 4 --- src/or/include.am | 7 ------ src/or/main.c | 4 --- src/or/ntmain.c | 4 --- src/or/periodic.c | 4 --- src/or/scheduler.c | 4 --- 10 files changed, 1 insertion(+), 108 deletions(-) (limited to 'src/or') diff --git a/src/or/config.c b/src/or/config.c index 754b0afb9e..307ddd3a27 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -7204,8 +7204,6 @@ init_libevent(const or_options_t *options) */ suppress_libevent_log_msg("Function not implemented"); - tor_check_libevent_header_compatibility(); - memset(&cfg, 0, sizeof(cfg)); cfg.disable_iocp = options->DisableIOCP; cfg.num_cpus = get_num_cpus(options); diff --git a/src/or/control.c b/src/or/control.c index d3613d8d4f..885583f16d 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -51,11 +51,7 @@ #include #endif -#ifdef HAVE_EVENT2_EVENT_H #include -#else -#include -#endif #include "crypto_s2k.h" #include "procmon.h" diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 3109d5a177..2e76ea5b78 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -23,11 +23,7 @@ #include "router.h" #include "workqueue.h" -#ifdef HAVE_EVENT2_EVENT_H #include -#else -#include -#endif static void queue_pending_tasks(void); diff --git a/src/or/dns.c b/src/or/dns.c index c7adfbc971..aaffad77fc 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -27,61 +27,8 @@ #include "router.h" #include "ht.h" #include "sandbox.h" -#ifdef HAVE_EVENT2_DNS_H #include #include -#else -#include -#include "eventdns.h" -#ifndef HAVE_EVDNS_SET_DEFAULT_OUTGOING_BIND_ADDRESS -#define HAVE_EVDNS_SET_DEFAULT_OUTGOING_BIND_ADDRESS -#endif -#endif - -#ifndef HAVE_EVENT2_DNS_H -struct evdns_base; -struct evdns_request; -#define evdns_base_new(x,y) tor_malloc(1) -#define evdns_base_clear_nameservers_and_suspend(base) \ - evdns_clear_nameservers_and_suspend() -#define evdns_base_search_clear(base) evdns_search_clear() -#define evdns_base_set_default_outgoing_bind_address(base, a, len) \ - evdns_set_default_outgoing_bind_address((a),(len)) -#define evdns_base_resolv_conf_parse(base, options, fname) \ - evdns_resolv_conf_parse((options), (fname)) -#define evdns_base_count_nameservers(base) \ - evdns_count_nameservers() -#define evdns_base_resume(base) \ - evdns_resume() -#define evdns_base_config_windows_nameservers(base) \ - evdns_config_windows_nameservers() -#define evdns_base_set_option_(base, opt, val) \ - evdns_set_option((opt),(val),DNS_OPTIONS_ALL) -/* Note: our internal eventdns.c, plus Libevent 1.4, used a 1 return to - * signify failure to launch a resolve. Libevent 2.0 uses a -1 return to - * signify a failure on a resolve, though if we're on Libevent 2.0, we should - * have event2/dns.h and never hit these macros. Regardless, 0 is success. */ -#define evdns_base_resolve_ipv4(base, addr, options, cb, ptr) \ - ((evdns_resolve_ipv4((addr), (options), (cb), (ptr))!=0) \ - ? NULL : ((void*)1)) -#define evdns_base_resolve_ipv6(base, addr, options, cb, ptr) \ - ((evdns_resolve_ipv6((addr), (options), (cb), (ptr))!=0) \ - ? NULL : ((void*)1)) -#define evdns_base_resolve_reverse(base, addr, options, cb, ptr) \ - ((evdns_resolve_reverse((addr), (options), (cb), (ptr))!=0) \ - ? NULL : ((void*)1)) -#define evdns_base_resolve_reverse_ipv6(base, addr, options, cb, ptr) \ - ((evdns_resolve_reverse_ipv6((addr), (options), (cb), (ptr))!=0) \ - ? NULL : ((void*)1)) - -#elif defined(LIBEVENT_VERSION_NUMBER) && LIBEVENT_VERSION_NUMBER < 0x02000303 -#define evdns_base_set_option_(base, opt, val) \ - evdns_base_set_option((base), (opt),(val),DNS_OPTIONS_ALL) - -#else -#define evdns_base_set_option_ evdns_base_set_option - -#endif /** How long will we wait for an answer from the resolver before we decide * that the resolver is wedged? */ @@ -1373,23 +1320,6 @@ configure_nameservers(int force) } } -#ifdef HAVE_EVDNS_SET_DEFAULT_OUTGOING_BIND_ADDRESS - if (! tor_addr_is_null(&options->OutboundBindAddressIPv4_)) { - int socklen; - struct sockaddr_storage ss; - socklen = tor_addr_to_sockaddr(&options->OutboundBindAddressIPv4_, 0, - (struct sockaddr *)&ss, sizeof(ss)); - if (socklen <= 0) { - log_warn(LD_BUG, "Couldn't convert outbound bind address to sockaddr." - " Ignoring."); - } else { - evdns_base_set_default_outgoing_bind_address(the_evdns_base, - (struct sockaddr *)&ss, - socklen); - } - } -#endif - evdns_set_log_fn(evdns_log_cb); if (conf_fname) { log_debug(LD_FS, "stat()ing %s", conf_fname); @@ -1454,7 +1384,7 @@ configure_nameservers(int force) } #endif -#define SET(k,v) evdns_base_set_option_(the_evdns_base, (k), (v)) +#define SET(k,v) evdns_base_set_option(the_evdns_base, (k), (v)) if (evdns_base_count_nameservers(the_evdns_base) == 1) { SET("max-timeouts:", "16"); diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c index edca50f6f9..6aab1e2c36 100644 --- a/src/or/dnsserv.c +++ b/src/or/dnsserv.c @@ -17,14 +17,10 @@ #include "control.h" #include "main.h" #include "policies.h" -#ifdef HAVE_EVENT2_DNS_H #include #include /* XXXX this implies we want an improved evdns */ #include -#else -#include "eventdns.h" -#endif /** Helper function: called by evdns whenever the client sends a request to our * DNSPort. We need to eventually answer the request req. diff --git a/src/or/include.am b/src/or/include.am index 744a507402..705b761ae3 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -17,12 +17,6 @@ endif EXTRA_DIST+= src/or/ntmain.c src/or/Makefile.nmake -if USE_EXTERNAL_EVDNS -evdns_source= -else -evdns_source=src/ext/eventdns.c -endif - LIBTOR_A_SOURCES = \ src/or/addressmap.c \ src/or/buffers.c \ @@ -86,7 +80,6 @@ LIBTOR_A_SOURCES = \ src/or/status.c \ src/or/torcert.c \ src/or/onion_ntor.c \ - $(evdns_source) \ $(tor_platform_source) src_or_libtor_a_SOURCES = $(LIBTOR_A_SOURCES) diff --git a/src/or/main.c b/src/or/main.c index f6575544d9..1d22879040 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -69,11 +69,7 @@ #include "memarea.h" #include "sandbox.h" -#ifdef HAVE_EVENT2_EVENT_H #include -#else -#include -#endif #ifdef USE_BUFFEREVENTS #include diff --git a/src/or/ntmain.c b/src/or/ntmain.c index ded0e0d307..a1b886bb5a 100644 --- a/src/or/ntmain.c +++ b/src/or/ntmain.c @@ -16,11 +16,7 @@ #include "main.h" #include "ntmain.h" -#ifdef HAVE_EVENT2_EVENT_H #include -#else -#include -#endif #include #define GENSRV_SERVICENAME "tor" diff --git a/src/or/periodic.c b/src/or/periodic.c index 057fcf672e..0bccc6ec20 100644 --- a/src/or/periodic.c +++ b/src/or/periodic.c @@ -12,11 +12,7 @@ #include "config.h" #include "periodic.h" -#ifdef HAVE_EVENT2_EVENT_H #include -#else -#include -#endif /** We disable any interval greater than this number of seconds, on the * grounds that it is probably an absolute time mistakenly passed in as a diff --git a/src/or/scheduler.c b/src/or/scheduler.c index 8e4810b199..3fab3026d8 100644 --- a/src/or/scheduler.c +++ b/src/or/scheduler.c @@ -15,11 +15,7 @@ #define SCHEDULER_PRIVATE_ #include "scheduler.h" -#ifdef HAVE_EVENT2_EVENT_H #include -#else -#include -#endif /* * Scheduler high/low watermarks -- cgit v1.2.3-54-g00ecf