Commit 998645aa authored by Jelte Jansen's avatar Jelte Jansen Committed by JINMEI Tatuya
Browse files

[2278] remove a bit of dead code

parent 55d94bb5
......@@ -50,9 +50,6 @@ class DerivedRRsetEntry: public RRsetEntry {
public:
DerivedRRsetEntry(const isc::dns::RRset& rrset, const RRsetTrustLevel& level) : RRsetEntry(rrset, level) {};
void updateTTLForTest() {
}
};
#define TEST_TTL 100
......
......@@ -37,6 +37,7 @@ protected:
{
ostringstream oss1;
oss1 << test_class_code;
// cppcheck-suppress useInitializationList
test_class_unknown_str = "CLASS" + oss1.str();
ostringstream oss2;
......
......@@ -176,7 +176,7 @@ class RunningQuery : public IOFetch::Callback {
class ResolverNSASCallback : public isc::nsas::AddressRequestCallback {
public:
ResolverNSASCallback(RunningQuery* rq) : rq_(rq) {}
void success(const isc::nsas::NameserverAddress& address) {
// Success callback, send query to found namesever
LOG_DEBUG(isc::resolve::logger, RESLIB_DBG_CB, RESLIB_RUNQ_SUCCESS)
......@@ -184,7 +184,7 @@ public:
rq_->nsasCallbackCalled();
rq_->sendTo(address);
}
void unreachable() {
// Nameservers unreachable: drop query or send servfail?
LOG_DEBUG(isc::resolve::logger, RESLIB_DBG_CB, RESLIB_RUNQ_FAIL);
......@@ -261,7 +261,7 @@ private:
bool done_;
// If we have a client timeout, we call back with a failure message,
// but we do not stop yet. We use this variable to make sure we
// but we do not stop yet. We use this variable to make sure we
// don't call back a second time later
bool callback_called_;
......@@ -270,7 +270,7 @@ private:
// Reference to our cache
isc::cache::ResolverCache& cache_;
// the 'current' zone we are in (i.e.) we start out at the root,
// and for each delegation this gets updated with the zone the
// delegation points to.
......@@ -278,7 +278,7 @@ private:
// of the call we use it in take a string, we need update those
// too).
std::string cur_zone_;
// This is the handler we pass on to the NSAS; it is called when
// the NSAS has an address for us to query
boost::shared_ptr<ResolverNSASCallback> nsas_callback_;
......@@ -295,7 +295,7 @@ private:
// The moment in time we sent a query to the nameserver above.
struct timeval current_ns_qsent_time;
// RunningQuery deletes itself when it is done. In order for us
// to do this safely, we must make sure that there are no events
// that might call back to it. There are two types of events in
......@@ -365,7 +365,7 @@ private:
io_.get_io_service().post(query);
}
}
// 'general' send, ask the NSAS to give us an address.
void send(IOFetch::Protocol protocol = IOFetch::UDP, bool edns = true) {
protocol_ = protocol; // Store protocol being used for this
......@@ -397,7 +397,7 @@ private:
nsas_.lookup(cur_zone_, question_.getClass(), nsas_callback_);
}
}
// Called by our NSAS callback handler so we know we do not have
// an outstanding NSAS call anymore.
void nsasCallbackCalled() {
......@@ -422,13 +422,13 @@ private:
// here (classify() will set it when it walks through
// the cname chain to verify it).
Name cname_target(question_.getName());
isc::resolve::ResponseClassifier::Category category =
isc::resolve::ResponseClassifier::classify(
question_, incoming, cname_target, cname_count_);
bool found_ns = false;
switch (category) {
case isc::resolve::ResponseClassifier::ANSWER:
case isc::resolve::ResponseClassifier::ANSWERCNAME:
......@@ -569,7 +569,7 @@ private:
// SERVFAIL if we get FORMERR instead
}
goto SERVFAIL;
default:
SERVFAIL:
// Some error in received packet it. Report it and return SERVFAIL
......@@ -718,7 +718,7 @@ public:
++outstanding_events_;
lookup_timer.async_wait(boost::bind(&RunningQuery::lookupTimeout, this));
}
// Setup the timer to send an answer (client_timeout)
if (client_timeout >= 0) {
client_timer.expires_from_now(
......@@ -726,7 +726,7 @@ public:
++outstanding_events_;
client_timer.async_wait(boost::bind(&RunningQuery::clientTimeout, this));
}
doLookup();
}
......@@ -741,7 +741,7 @@ public:
--outstanding_events_;
stop();
}
// called if we have a client timeout; if our callback has
// not been called, call it now. But do not stop.
void clientTimeout() {
......@@ -810,7 +810,7 @@ public:
// XXX is this the place for TCP retry?
assert(outstanding_events_ > 0);
--outstanding_events_;
if (!done_ && result != IOFetch::TIME_OUT) {
// we got an answer
......@@ -890,7 +890,7 @@ public:
stop();
}
}
// Clear the answer parts of answer_message, and set the rcode
// to servfail
void makeSERVFAIL() {
......@@ -1096,7 +1096,7 @@ RecursiveQuery::resolve(const QuestionPtr& question,
// Message found, return that
LOG_DEBUG(isc::resolve::logger, RESLIB_DBG_CACHE, RESLIB_RECQ_CACHE_FIND)
.arg(questionText(*question)).arg(1);
// TODO: err, should cache set rcode as well?
answer_message->setRcode(Rcode::NOERROR());
callback->success(answer_message);
......@@ -1146,11 +1146,11 @@ RecursiveQuery::resolve(const Question& question,
// TODO: general 'prepareinitialanswer'
answer_message->setOpcode(isc::dns::Opcode::QUERY());
answer_message->addQuestion(question);
// First try to see if we have something cached in the messagecache
LOG_DEBUG(isc::resolve::logger, RESLIB_DBG_TRACE, RESLIB_RESOLVE)
.arg(questionText(question)).arg(2);
if (cache_.lookup(question.getName(), question.getType(),
question.getClass(), *answer_message) &&
answer_message->getRRCount(Message::SECTION_ANSWER) > 0) {
......@@ -1181,7 +1181,7 @@ RecursiveQuery::resolve(const Question& question,
// delete itself when it is done
LOG_DEBUG(isc::resolve::logger, RESLIB_DBG_TRACE, RESLIB_RECQ_CACHE_NO_FIND)
.arg(questionText(question)).arg(2);
new RunningQuery(io, question, answer_message,
new RunningQuery(io, question, answer_message,
test_server_, buffer, crs, query_timeout_,
client_timeout_, lookup_timeout_, retries_,
nsas_, cache_, rtt_recorder_);
......
......@@ -218,7 +218,7 @@ protected:
}
// Receive a UDP packet from a mock server; used for testing
// recursive lookup. The caller must place a RecursiveQuery
// recursive lookup. The caller must place a RecursiveQuery
// on the IO Service queue before running this routine.
void recvUDP(const int family, void* buffer, size_t& size) {
ScopedAddrInfo sai(resolveAddress(family, IPPROTO_UDP, true));
......@@ -267,7 +267,7 @@ protected:
if (ret < 0) {
isc_throw(IOError, "recvfrom failed: " << strerror(errno));
}
// Pass the message size back via the size parameter
size = ret;
}
......@@ -693,37 +693,6 @@ createTestSocket() {
return (sock.release());
}
int
setSocketTimeout(int sock, size_t tv_sec, size_t tv_usec) {
const struct timeval timeo = { tv_sec, tv_usec };
int recv_options = 0;
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo))) {
if (errno == ENOPROTOOPT) { // see RecursiveQueryTest::recvUDP()
recv_options = MSG_DONTWAIT;
} else {
isc_throw(IOError, "set RCVTIMEO failed: " << strerror(errno));
}
}
return (recv_options);
}
// try to read from the socket max time
// *num is incremented for every succesfull read
// returns true if it can read max times, false otherwise
bool tryRead(int sock, int recv_options, size_t max, int* num) {
size_t i = 0;
do {
char inbuff[512];
if (recv(sock, inbuff, sizeof(inbuff), recv_options) < 0) {
return false;
} else {
++i;
++*num;
}
} while (i < max);
return true;
}
// Mock resolver callback for testing forward query.
class MockResolverCallback : public isc::resolve::ResolverInterface::Callback {
public:
......@@ -904,7 +873,7 @@ TEST_F(RecursiveQueryTest, lowtimeouts) {
TEST_F(RecursiveQueryTest, DISABLED_recursiveSendOk) {
setDNSService(true, false);
bool done;
MockServerStop server(io_service_, &done);
vector<pair<string, uint16_t> > empty_vector;
RecursiveQuery rq(*dns_service_, *nsas_, cache_, empty_vector,
......@@ -930,7 +899,7 @@ TEST_F(RecursiveQueryTest, DISABLED_recursiveSendOk) {
TEST_F(RecursiveQueryTest, DISABLED_recursiveSendNXDOMAIN) {
setDNSService(true, false);
bool done;
MockServerStop server(io_service_, &done);
vector<pair<string, uint16_t> > empty_vector;
RecursiveQuery rq(*dns_service_, *nsas_, cache_, empty_vector,
......
......@@ -168,7 +168,7 @@ protected:
entry7_(new TestEntry("eta", 1))
{}
virtual ~LruListTest()
virtual ~LruListTest()
{}
boost::shared_ptr<TestEntry> entry1_;
......@@ -355,7 +355,7 @@ TEST_F(LruListTest, Dropped) {
lru.add(entry5_);
EXPECT_NE(0, (entry2_->getCode() & 0x8000));
// Delete an entry and check that the handler does not run.
// Delete an entry and check that the handler does not run.
EXPECT_EQ(0, (entry3_->getCode() & 0x8000));
lru.remove(entry3_);
EXPECT_EQ(0, (entry3_->getCode() & 0x8000));
......@@ -386,7 +386,7 @@ TEST_F(LruListTest, Clear) {
EXPECT_NE(0, (entry1_->getCode() & 0x8000));
EXPECT_NE(0, (entry2_->getCode() & 0x8000));
EXPECT_NE(0, (entry3_->getCode() & 0x8000));
EXPECT_EQ(0, lru.size());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment