- added L.ROOT-SERVERS.NET. AAAA 2001:500:3::42 to builtin root hints.

- fixup so it works with libev-3.51 from http://dist.schmorp.de/libev/
- comm_timer_set performs base_set operation after event_add.



git-svn-id: file:///svn/unbound/trunk@1406 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-01-05 15:05:33 +00:00
parent 4c76f1c003
commit 33ae9fd843
11 changed files with 130 additions and 5 deletions

View File

@ -52,6 +52,9 @@
/* Define to 1 if you have the `EVP_sha512' function. */
#undef HAVE_EVP_SHA512
/* Define to 1 if you have the `ev_loop' function. */
#undef HAVE_EV_LOOP
/* Define to 1 if you have the `fcntl' function. */
#undef HAVE_FCNTL

94
configure vendored
View File

@ -23235,6 +23235,100 @@ _ACEOF
fi
done
# only in libevent 1.4.3 and later
for ac_func in ev_loop
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
# only in libev. (tested on 3.51)
if test -n "$BAK_LDFLAGS"; then
LDFLAGS="$BAK_LDFLAGS"
fi

View File

@ -705,6 +705,7 @@ large outgoing port ranges. ])
AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4? and later
AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
if test -n "$BAK_LDFLAGS"; then
LDFLAGS="$BAK_LDFLAGS"
fi

View File

@ -409,6 +409,12 @@ daemon_fork(struct daemon* daemon)
* them to the newly created threads.
*/
daemon_create_workers(daemon);
#ifdef HAVE_EV_LOOP
/* in libev the first inited base gets signals */
if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1))
fatal_exit("Could not initialize main thread");
#endif
/* Now create the threads and init the workers.
* By the way, this is thread #0 (the main thread).
@ -418,8 +424,11 @@ daemon_fork(struct daemon* daemon)
/* Special handling for the main thread. This is the thread
* that handles signals and remote control.
*/
#ifndef HAVE_EV_LOOP
/* libevent has the last inited base get signals (or any base) */
if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1))
fatal_exit("Could not initialize main thread");
#endif
signal_handling_playback(daemon->workers[0]);
/* Start resolver service on main thread. */

View File

@ -984,7 +984,7 @@ worker_init(struct worker* worker, struct config_file *cfg,
{
unsigned int seed;
worker->need_to_exit = 0;
worker->base = comm_base_create();
worker->base = comm_base_create(do_sigs);
if(!worker->base) {
log_err("could not create event handling base");
worker_delete(worker);

View File

@ -1,5 +1,8 @@
5 January 2009: Wouter
- fixup getaddrinfo failure handling for remote control port.
- added L.ROOT-SERVERS.NET. AAAA 2001:500:3::42 to builtin root hints.
- fixup so it works with libev-3.51 from http://dist.schmorp.de/libev/
- comm_timer_set performs base_set operation after event_add.
18 December 2008: Wouter
- fixed bug reported by Duane Wessels: error in DLV lookup, would make

View File

@ -133,6 +133,7 @@ compile_time_root_prime(struct regional* r, int do_ip4, int do_ip6)
if(!ah(dp, r, "H.ROOT-SERVERS.NET.", "2001:500:1::803f:235")) return 0;
if(!ah(dp, r, "J.ROOT-SERVERS.NET.", "2001:503:c27::2:30")) return 0;
if(!ah(dp, r, "K.ROOT-SERVERS.NET.", "2001:7fd::1")) return 0;
if(!ah(dp, r, "L.ROOT-SERVERS.NET.", "2001:500:3::42")) return 0;
if(!ah(dp, r, "M.ROOT-SERVERS.NET.", "2001:dc3::35")) return 0;
}
return dp;

View File

@ -141,7 +141,7 @@ libworker_setup(struct ub_ctx* ctx, int is_bg)
}
seed = 0;
w->base = comm_base_create();
w->base = comm_base_create(0);
if(!w->base) {
libworker_delete(w);
return NULL;

View File

@ -596,7 +596,7 @@ listen_delete(struct listen_dnsport* listen)
}
struct comm_base*
comm_base_create()
comm_base_create(int ATTR_UNUSED(sigs))
{
/* we return the runtime structure instead. */
struct replay_runtime* runtime = (struct replay_runtime*)

View File

@ -136,7 +136,7 @@ comm_base_now(struct comm_base* b)
#endif /* USE_MINI_EVENT */
struct comm_base*
comm_base_create()
comm_base_create(int sigs)
{
struct comm_base* b = (struct comm_base*)calloc(1,
sizeof(struct comm_base));
@ -151,7 +151,16 @@ comm_base_create()
/* use mini event time-sharing feature */
b->eb->base = event_init(&b->eb->secs, &b->eb->now);
#else
# ifdef HAVE_EV_LOOP
/* libev */
if(sigs)
b->eb->base=(struct event_base *)ev_default_loop(EVFLAG_AUTO);
else
b->eb->base=(struct event_base *)ev_loop_new(EVFLAG_AUTO);
# else
(void)sigs;
b->eb->base = event_init();
# endif
#endif
if(!b->eb->base) {
free(b->eb);
@ -1553,6 +1562,9 @@ comm_timer_set(struct comm_timer* timer, struct timeval* tv)
comm_timer_disable(timer);
event_set(&timer->ev_timer->ev, -1, EV_PERSIST|EV_TIMEOUT,
comm_timer_callback, timer);
if(event_base_set(timer->ev_timer->base->eb->base,
&timer->ev_timer->ev) != 0)
log_err("comm_timer_set: set_base failed.");
if(evtimer_add(&timer->ev_timer->ev, tv) != 0)
log_err("comm_timer_set: evtimer_add failed.");
timer->ev_timer->enabled = 1;

View File

@ -260,9 +260,11 @@ struct comm_signal {
/**
* Create a new comm base.
* @param sigs: if true it attempts to create a default loop for
* signal handling.
* @return: the new comm base. NULL on error.
*/
struct comm_base* comm_base_create();
struct comm_base* comm_base_create(int sigs);
/**
* Destroy a comm base.