mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
libev can be used (but not multithreaded) and del fd unused.
git-svn-id: file:///svn/unbound/trunk@1023 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
d26b183ba6
commit
46e703c989
7 changed files with 41 additions and 7 deletions
6
configure
vendored
6
configure
vendored
|
|
@ -21971,7 +21971,7 @@ echo $ECHO_N "checking for libevent... $ECHO_C" >&6; }
|
|||
fi
|
||||
done
|
||||
if test x_$found_libevent != x_yes; then
|
||||
if test -f "$dir/event.h" -a -f "$dir/libevent.la"; then
|
||||
if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then
|
||||
# libevent source directory
|
||||
{ echo "$as_me:$LINENO: result: found in $thedir" >&5
|
||||
echo "${ECHO_T}found in $thedir" >&6; }
|
||||
|
|
@ -21987,8 +21987,8 @@ echo "${ECHO_T}found in $thedir" >&6; }
|
|||
cp $ev_files_o build/libevent
|
||||
cp $ev_files_lo build/libevent
|
||||
cp $ev_files_libso build/libevent/.libs
|
||||
LATE_LDFLAGS="build/libevent/*.lo"
|
||||
LDFLAGS="build/libevent/*.o $LDFLAGS"
|
||||
LATE_LDFLAGS="build/libevent/*.lo -lm"
|
||||
LDFLAGS="build/libevent/*.o $LDFLAGS -lm"
|
||||
else
|
||||
{ { echo "$as_me:$LINENO: error: Cannot find the libevent library in $withval
|
||||
You can restart ./configure --with-libevent=no to use a builtin alternative.
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ if test x_$withval == x_yes -o x_$withval != x_no; then
|
|||
fi
|
||||
done
|
||||
if test x_$found_libevent != x_yes; then
|
||||
if test -f "$dir/event.h" -a -f "$dir/libevent.la"; then
|
||||
if test -f "$dir/event.h" -a \( -f "$dir/libevent.la" -o -f "$dir/libev.la" \) ; then
|
||||
# libevent source directory
|
||||
AC_MSG_RESULT(found in $thedir)
|
||||
CPPFLAGS="$CPPFLAGS -I$thedir"
|
||||
|
|
@ -535,8 +535,8 @@ if test x_$withval == x_yes -o x_$withval != x_no; then
|
|||
cp $ev_files_o build/libevent
|
||||
cp $ev_files_lo build/libevent
|
||||
cp $ev_files_libso build/libevent/.libs
|
||||
LATE_LDFLAGS="build/libevent/*.lo"
|
||||
LDFLAGS="build/libevent/*.o $LDFLAGS"
|
||||
LATE_LDFLAGS="build/libevent/*.lo -lm"
|
||||
LDFLAGS="build/libevent/*.o $LDFLAGS -lm"
|
||||
else
|
||||
AC_MSG_ERROR([Cannot find the libevent library in $withval
|
||||
You can restart ./configure --with-libevent=no to use a builtin alternative.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
9 April 2008: Wouter
|
||||
- configure can detect libev(from its build directory) when passed
|
||||
--with-libevent=/home/wouter/libev-3.2
|
||||
libev-3.2 is a little faster than libevent-1.4.3-stable (about 5%).
|
||||
- unused commpoints not listed in epoll list.
|
||||
|
||||
8 April 2008: Wouter
|
||||
- unbound tries to set the ulimit fds when started as server.
|
||||
if that does not work, it will scale back its requirements.
|
||||
|
|
|
|||
|
|
@ -275,6 +275,9 @@ outnet_udp_cb(struct comm_point* c, void* arg, int error,
|
|||
(void)rbtree_delete(outnet->pending, p->node.key);
|
||||
fptr_ok(fptr_whitelist_pending_udp(p->cb));
|
||||
(void)(*p->cb)(p->c, p->cb_arg, NETEVENT_NOERROR, reply_info);
|
||||
p->c->inuse--;
|
||||
if(p->c->inuse == 0)
|
||||
comm_point_stop_listening(p->c);
|
||||
pending_delete(NULL, p);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -367,9 +370,12 @@ make_udp_range(struct comm_point** coms, const char* ifname,
|
|||
}
|
||||
coms[done] = comm_point_create_udp(outnet->base, fd,
|
||||
outnet->udp_buff, outnet_udp_cb, outnet);
|
||||
if(coms[done])
|
||||
if(coms[done]) {
|
||||
log_assert(coms[done]->inuse == 0);
|
||||
comm_point_stop_listening(coms[done]);
|
||||
done++;
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
|
|
@ -409,6 +415,9 @@ pending_udp_timer_cb(void *arg)
|
|||
verbose(VERB_ALGO, "timeout udp");
|
||||
fptr_ok(fptr_whitelist_pending_udp(p->cb));
|
||||
(void)(*p->cb)(p->c, p->cb_arg, NETEVENT_TIMEOUT, NULL);
|
||||
p->c->inuse--;
|
||||
if(p->c->inuse == 0)
|
||||
comm_point_stop_listening(p->c);
|
||||
pending_delete(p->outnet, p);
|
||||
}
|
||||
|
||||
|
|
@ -528,6 +537,9 @@ pending_node_del(rbnode_t* node, void* arg)
|
|||
{
|
||||
struct pending* pend = (struct pending*)node;
|
||||
struct outside_network* outnet = (struct outside_network*)arg;
|
||||
pend->c->inuse--;
|
||||
if(pend->c->inuse == 0)
|
||||
comm_point_stop_listening(pend->c);
|
||||
pending_delete(outnet, pend);
|
||||
}
|
||||
|
||||
|
|
@ -725,6 +737,9 @@ pending_udp_query(struct outside_network* outnet, ldns_buffer* packet,
|
|||
pending_delete(outnet, pend);
|
||||
return NULL;
|
||||
}
|
||||
if(pend->c->inuse == 0)
|
||||
comm_point_start_listening(pend->c, -1, -1);
|
||||
pend->c->inuse++;
|
||||
|
||||
/* system calls to set timeout after sending UDP to make roundtrip
|
||||
smaller. */
|
||||
|
|
@ -916,6 +931,9 @@ serviced_delete(struct serviced_query* sq)
|
|||
if(sq->status == serviced_query_UDP_EDNS ||
|
||||
sq->status == serviced_query_UDP) {
|
||||
struct pending* p = (struct pending*)sq->pending;
|
||||
p->c->inuse--;
|
||||
if(p->c->inuse == 0)
|
||||
comm_point_stop_listening(p->c);
|
||||
pending_delete(sq->outnet, p);
|
||||
} else {
|
||||
struct waiting_tcp* p = (struct waiting_tcp*)
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ struct outside_network {
|
|||
* Each is on a different port. This is for ip4 ports.
|
||||
*/
|
||||
struct comm_point** udp4_ports;
|
||||
/** number of queries open on each port */
|
||||
int* udp4_inuse;
|
||||
/** number of udp4 ports */
|
||||
size_t num_udp4;
|
||||
|
||||
|
|
@ -86,6 +88,8 @@ struct outside_network {
|
|||
* The opened ip6 ports.
|
||||
*/
|
||||
struct comm_point** udp6_ports;
|
||||
/** number of queries open on each port */
|
||||
int* udp6_inuse;
|
||||
/** number of udp6 ports */
|
||||
size_t num_udp6;
|
||||
|
||||
|
|
|
|||
|
|
@ -850,6 +850,7 @@ comm_point_create_udp(struct comm_base *base, int fd, ldns_buffer* buffer,
|
|||
c->do_not_close = 0;
|
||||
c->tcp_do_toggle_rw = 0;
|
||||
c->tcp_check_nb_connect = 0;
|
||||
c->inuse = 0;
|
||||
c->callback = callback;
|
||||
c->cb_arg = callback_arg;
|
||||
evbits = EV_READ | EV_PERSIST;
|
||||
|
|
@ -893,6 +894,7 @@ comm_point_create_udp_ancil(struct comm_base *base, int fd,
|
|||
c->type = comm_udp;
|
||||
c->tcp_do_close = 0;
|
||||
c->do_not_close = 0;
|
||||
c->inuse = 0;
|
||||
c->tcp_do_toggle_rw = 0;
|
||||
c->tcp_check_nb_connect = 0;
|
||||
c->callback = callback;
|
||||
|
|
|
|||
|
|
@ -191,6 +191,10 @@ struct comm_point {
|
|||
/** if set, checks for pending error from nonblocking connect() call.*/
|
||||
int tcp_check_nb_connect;
|
||||
|
||||
/** number of queries outstanding on this socket, used by
|
||||
* outside network for udp ports */
|
||||
int inuse;
|
||||
|
||||
/** callback when done.
|
||||
tcp_accept does not get called back, is NULL then.
|
||||
If a timeout happens, callback with timeout=1 is called.
|
||||
|
|
|
|||
Loading…
Reference in a new issue