Commit 425b14dc authored by Yoshitaka Aharen's avatar Yoshitaka Aharen
Browse files

[2157] removed a member from QRAttributes

parent b2d762a1
......@@ -237,7 +237,8 @@ public:
BaseSocketSessionForwarder& ddns_forwarder);
~AuthSrvImpl();
bool processNormalQuery(const IOMessage& io_message, Message& message,
bool processNormalQuery(const IOMessage& io_message,
ConstEDNSPtr remote_edns, Message& message,
OutputBuffer& buffer,
auto_ptr<TSIGContext> tsig_context);
bool processXfrQuery(const IOMessage& io_message, Message& message,
......@@ -571,13 +572,11 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
try {
// statistics: check EDNS
// note: This can only be reliable after TSIG check succeeds.
{
ConstEDNSPtr edns = message.getEDNS();
if (edns != NULL) {
impl_->stats_attrs_.setQueryEDNS(true,
edns->getVersion() != 0);
impl_->stats_attrs_.setQueryDO(edns->getDNSSECAwareness());
}
ConstEDNSPtr edns = message.getEDNS();
if (edns) {
impl_->stats_attrs_.setQueryEDNS(true,
edns->getVersion() != 0);
impl_->stats_attrs_.setQueryDO(edns->getDNSSECAwareness());
}
// statistics: check OpCode
......@@ -612,8 +611,9 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
send_answer = impl_->processXfrQuery(io_message, message,
buffer, tsig_context);
} else {
send_answer = impl_->processNormalQuery(io_message, message,
buffer, tsig_context);
send_answer = impl_->processNormalQuery(io_message, edns,
message, buffer,
tsig_context);
}
}
} catch (const std::exception& ex) {
......@@ -628,11 +628,11 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
}
bool
AuthSrvImpl::processNormalQuery(const IOMessage& io_message, Message& message,
AuthSrvImpl::processNormalQuery(const IOMessage& io_message,
ConstEDNSPtr remote_edns, Message& message,
OutputBuffer& buffer,
auto_ptr<TSIGContext> tsig_context)
{
ConstEDNSPtr remote_edns = message.getEDNS();
const bool dnssec_ok = remote_edns && remote_edns->getDNSSECAwareness();
const uint16_t remote_bufsize = remote_edns ? remote_edns->getUDPSize() :
Message::DEFAULT_MAX_UDPSIZE;
......@@ -820,11 +820,10 @@ void
AuthSrvImpl::resumeServer(DNSServer* server, Message& message,
const bool done) {
if (done) {
stats_attrs_.answerWasSent();
// isTruncated from MessageRenderer
stats_attrs_.setResponseTruncated(renderer_.isTruncated());
}
counters_.inc(stats_attrs_, message);
counters_.inc(stats_attrs_, message, done);
stats_attrs_.reset();
server->resume(done);
}
......
......@@ -238,11 +238,13 @@ Counters::incResponse(const QRAttributes& qrattrs, const Message& response) {
}
void
Counters::inc(const QRAttributes& qrattrs, const Message& response) {
Counters::inc(const QRAttributes& qrattrs, const Message& response,
const bool done)
{
// increment request counters
incRequest(qrattrs);
if (qrattrs.answer_sent_) {
if (done) {
// increment response counters if answer was sent
incResponse(qrattrs, response);
}
......
......@@ -101,10 +101,6 @@ public:
/// \throw None
inline void setOrigin(const std::string& origin);
/// \brief Set if the answer has sent.
/// \throw None
inline void answerWasSent();
/// \brief Set if the response is truncated.
/// \throw None
inline void setResponseTruncated(const bool is_truncated);
......@@ -163,11 +159,6 @@ QRAttributes::setQuerySig(const bool is_tsig, const bool is_sig0,
req_is_badsig_ = is_badsig;
}
inline void
QRAttributes::answerWasSent() {
answer_sent_ = true;
}
inline void
QRAttributes::setResponseTruncated(const bool is_truncated) {
res_is_truncated_ = is_truncated;
......@@ -256,10 +247,12 @@ public:
///
/// \param qrattrs Query/Response attributes.
/// \param response DNS response message.
/// \param done DNS response was sent to the client.
///
/// \throw std::bad_alloc Internal resource allocation fails
///
void inc(const QRAttributes& qrattrs, const isc::dns::Message& response);
void inc(const QRAttributes& qrattrs, const isc::dns::Message& response,
const bool done);
/// \brief Get statistics counters.
///
......
......@@ -113,13 +113,12 @@ TEST_F(CountersTest, incrementNormalQuery) {
qrattrs.setQueryOpCode(Opcode::QUERY_CODE);
qrattrs.setQueryEDNS(true, false);
qrattrs.setQueryDO(true);
qrattrs.answerWasSent();
response.setRcode(Rcode::REFUSED());
response.addQuestion(Question(Name("example.com"),
RRClass::IN(), RRType::AAAA()));
counters.inc(qrattrs, response);
counters.inc(qrattrs, response, true);
expect_nonzero.clear();
expect_nonzero.insert("opcode.query");
......
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