From 433ee5c4d6852b507b43eae9c9a2c9028c6b48e5 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 8 Feb 2017 22:30:00 +0000 Subject: [PATCH] [344] Don't compile in async dns support by default for makefiles. --- config.mk | 8 ++++++++ lib/mosquitto_internal.h | 2 +- lib/net_mosq.c | 2 +- src/bridge.c | 2 +- src/loop.c | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/config.mk b/config.mk index 3d2aa499..02df80b2 100644 --- a/config.mk +++ b/config.mk @@ -76,6 +76,9 @@ WITH_DOCS:=yes # Build with client support for SOCK5 proxy. WITH_SOCKS:=yes +# Build with async dns lookup support for bridges (temporary). Requires glibc. +#WITH_ADNS:=yes + # ============================================================================= # End of user configuration # ============================================================================= @@ -239,6 +242,11 @@ ifeq ($(WITH_EC),yes) BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_EC endif +ifeq ($(WITH_ADNS),yes) + BROKER_LIBS:=$(BROKER_LIBS) -lanl + BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_ADNS +endif + MAKE_ALL:=mosquitto ifeq ($(WITH_DOCS),yes) MAKE_ALL:=$(MAKE_ALL) docs diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h index e401a2fb..ac925738 100644 --- a/lib/mosquitto_internal.h +++ b/lib/mosquitto_internal.h @@ -155,7 +155,7 @@ struct mosquitto { #ifndef WITH_BROKER mosq_sock_t sockpairR, sockpairW; #endif -#ifdef __GLIBC__ +#if defined(__GLIBC__) && defined(WITH_ADNS) struct gaicb *adns; /* For getaddrinfo_a */ #endif enum _mosquitto_protocol protocol; diff --git a/lib/net_mosq.c b/lib/net_mosq.c index c98b2746..06c9bce2 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -271,7 +271,7 @@ static unsigned int psk_client_callback(SSL *ssl, const char *hint, } #endif -#if defined(WITH_BROKER) && defined(__GLIBC__) +#if defined(WITH_BROKER) && defined(__GLIBC__) && defined(WITH_ADNS) /* Async connect, part 1 (dns lookup) */ int _mosquitto_try_connect_step1(struct mosquitto *mosq, const char *host) { diff --git a/src/bridge.c b/src/bridge.c index ad9ef1d8..869b3db1 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -131,7 +131,7 @@ int mqtt3_bridge_new(struct mosquitto_db *db, struct _mqtt3_bridge *bridge) return MOSQ_ERR_NOMEM; } -#ifdef __GLIBC__ +#if defined(__GLIBC__) && defined(WITH_ADNS) new_context->bridge->restart_t = 1; /* force quick restart of bridge */ return mqtt3_bridge_connect_step1(db, new_context); #else diff --git a/src/loop.c b/src/loop.c index dba3c5ea..b7e8b752 100644 --- a/src/loop.c +++ b/src/loop.c @@ -247,7 +247,7 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li if((context->bridge->start_type == bst_lazy && context->bridge->lazy_reconnect) || (context->bridge->start_type == bst_automatic && now > context->bridge->restart_t)){ -#ifdef __GLIBC__ +#if defined(__GLIBC__) && defined(WITH_ADNS) if(context->adns){ /* Waiting on DNS lookup */ rc = gai_error(context->adns);