nameserv: move fallback DNS_Name2IPAddressAsync() to stubs.c
This commit is contained in:
parent
b54711252b
commit
f955b46c13
3 changed files with 19 additions and 21 deletions
3
configure
vendored
3
configure
vendored
|
@ -437,7 +437,7 @@ fi
|
||||||
|
|
||||||
if [ $feat_ntp = "1" ]; then
|
if [ $feat_ntp = "1" ]; then
|
||||||
add_def FEAT_NTP
|
add_def FEAT_NTP
|
||||||
EXTRA_OBJECTS="$EXTRA_OBJECTS broadcast.o nameserv_async.o ntp_core.o ntp_io.o ntp_sources.o"
|
EXTRA_OBJECTS="$EXTRA_OBJECTS broadcast.o ntp_core.o ntp_io.o ntp_sources.o"
|
||||||
else
|
else
|
||||||
feat_asyncdns=0
|
feat_asyncdns=0
|
||||||
fi
|
fi
|
||||||
|
@ -541,6 +541,7 @@ if [ $feat_asyncdns = "1" ] && \
|
||||||
then
|
then
|
||||||
add_def FEAT_ASYNCDNS
|
add_def FEAT_ASYNCDNS
|
||||||
add_def USE_PTHREAD_ASYNCDNS
|
add_def USE_PTHREAD_ASYNCDNS
|
||||||
|
EXTRA_OBJECTS="$EXTRA_OBJECTS nameserv_async.o"
|
||||||
MYCFLAGS="$MYCFLAGS -pthread"
|
MYCFLAGS="$MYCFLAGS -pthread"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#ifdef FEAT_ASYNCDNS
|
|
||||||
|
|
||||||
#ifdef USE_PTHREAD_ASYNCDNS
|
#ifdef USE_PTHREAD_ASYNCDNS
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
@ -124,21 +122,3 @@ DNS_Name2IPAddressAsync(const char *name, DNS_NameResolveHandler handler, void *
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* This is a blocking implementation used when nothing else is available */
|
|
||||||
|
|
||||||
void
|
|
||||||
DNS_Name2IPAddressAsync(const char *name, DNS_NameResolveHandler handler, void *anything)
|
|
||||||
{
|
|
||||||
IPAddr addr;
|
|
||||||
DNS_Status status;
|
|
||||||
|
|
||||||
status = DNS_Name2IPAddress(name, &addr);
|
|
||||||
(handler)(status, &addr, anything);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================================================== */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
17
stubs.c
17
stubs.c
|
@ -34,11 +34,28 @@
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "manual.h"
|
#include "manual.h"
|
||||||
#include "nameserv.h"
|
#include "nameserv.h"
|
||||||
|
#include "nameserv_async.h"
|
||||||
#include "ntp_core.h"
|
#include "ntp_core.h"
|
||||||
#include "ntp_io.h"
|
#include "ntp_io.h"
|
||||||
#include "ntp_sources.h"
|
#include "ntp_sources.h"
|
||||||
#include "refclock.h"
|
#include "refclock.h"
|
||||||
|
|
||||||
|
#ifndef FEAT_ASYNCDNS
|
||||||
|
|
||||||
|
/* This is a blocking implementation used when asynchronous resolving is not available */
|
||||||
|
|
||||||
|
void
|
||||||
|
DNS_Name2IPAddressAsync(const char *name, DNS_NameResolveHandler handler, void *anything)
|
||||||
|
{
|
||||||
|
IPAddr addr;
|
||||||
|
DNS_Status status;
|
||||||
|
|
||||||
|
status = DNS_Name2IPAddress(name, &addr);
|
||||||
|
(handler)(status, &addr, anything);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !FEAT_ASYNCDNS */
|
||||||
|
|
||||||
#ifndef FEAT_CMDMON
|
#ifndef FEAT_CMDMON
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue