[344] Only do async dns on glibc.

This commit is contained in:
Roger A. Light 2017-02-08 15:40:44 +00:00
parent 5eae4b56d6
commit 6f45ab9624
4 changed files with 4 additions and 4 deletions

View File

@ -155,7 +155,7 @@ struct mosquitto {
#ifndef WITH_BROKER #ifndef WITH_BROKER
mosq_sock_t sockpairR, sockpairW; mosq_sock_t sockpairR, sockpairW;
#endif #endif
#ifdef __linux__ #ifdef __GLIBC__
struct gaicb *adns; /* For getaddrinfo_a */ struct gaicb *adns; /* For getaddrinfo_a */
#endif #endif
enum _mosquitto_protocol protocol; enum _mosquitto_protocol protocol;

View File

@ -271,7 +271,7 @@ static unsigned int psk_client_callback(SSL *ssl, const char *hint,
} }
#endif #endif
#if defined(WITH_BROKER) && defined(__linux__) #if defined(WITH_BROKER) && defined(__GLIBC__)
/* Async connect, part 1 (dns lookup) */ /* Async connect, part 1 (dns lookup) */
int _mosquitto_try_connect_step1(struct mosquitto *mosq, const char *host) int _mosquitto_try_connect_step1(struct mosquitto *mosq, const char *host)
{ {

View File

@ -131,7 +131,7 @@ int mqtt3_bridge_new(struct mosquitto_db *db, struct _mqtt3_bridge *bridge)
return MOSQ_ERR_NOMEM; return MOSQ_ERR_NOMEM;
} }
#ifdef __linux__ #ifdef __GLIBC__
new_context->bridge->restart_t = 1; /* force quick restart of bridge */ new_context->bridge->restart_t = 1; /* force quick restart of bridge */
return mqtt3_bridge_connect_step1(db, new_context); return mqtt3_bridge_connect_step1(db, new_context);
#else #else

View File

@ -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) if((context->bridge->start_type == bst_lazy && context->bridge->lazy_reconnect)
|| (context->bridge->start_type == bst_automatic && now > context->bridge->restart_t)){ || (context->bridge->start_type == bst_automatic && now > context->bridge->restart_t)){
#ifdef __linux__ #ifdef __GLIBC__
if(context->adns){ if(context->adns){
/* Waiting on DNS lookup */ /* Waiting on DNS lookup */
rc = gai_error(context->adns); rc = gai_error(context->adns);