}
};
+static std::atomic<int> g_receivedAnswers1;
+static void report1(DNSPacket* A)
+{
+ delete A;
+ g_receivedAnswers1++;
+}
BOOST_AUTO_TEST_CASE(test_distributor_queue) {
+ ::arg().set("overload-queue-length","Maximum queuelength moving to packetcache only")="0";
+ ::arg().set("max-queue-length","Maximum queuelength before considering situation lost")="1000";
+ ::arg().set("queue-limit","Maximum number of milliseconds to queue a query")="1500";
+ S.declare("servfail-packets","Number of times a server-failed packet was sent out");
+ S.declare("timedout-packets", "timedout-packets");
+
auto d=Distributor<DNSPacket, Question, BackendSlow>::Create(2);
BOOST_CHECK_EXCEPTION( {
int n;
- for(n=0; n < 6000; ++n) {
+ // bound should be higher than max-queue-length
+ for(n=0; n < 2000; ++n) {
auto q = new Question();
q->d_dt.set();
- d->question(q, report);
+ d->question(q, report1);
}
}, DistributorFatal, [](DistributorFatal) { return true; });
};
BOOST_AUTO_TEST_CASE(test_distributor_dies) {
+ ::arg().set("overload-queue-length","Maximum queuelength moving to packetcache only")="0";
+ ::arg().set("max-queue-length","Maximum queuelength before considering situation lost")="5000";
+ ::arg().set("queue-limit","Maximum number of milliseconds to queue a query")="1500";
+ S.declare("servfail-packets","Number of times a server-failed packet was sent out");
+ S.declare("timedout-packets", "timedout-packets");
+
auto d=Distributor<DNSPacket, Question, BackendDies>::Create(10);
- sleep(1);
- g_receivedAnswers=0;
try {
for(int n=0; n < 100; ++n) {