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; }
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.
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"
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.
+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.
(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;
}
}
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;
}
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);
}
{
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);
}
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. */
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*)
* 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;
* 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;
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;
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;
/** 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.