Commit 2f88c7ad authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2013] (related bug fix) make Message::clearSection clear questions correctly.

this fix is necessary for ddns to make responses correctly.
parent f89b4428
......@@ -573,7 +573,11 @@ Message::clearSection(const Section section) {
if (section >= MessageImpl::NUM_SECTIONS) {
isc_throw(OutOfRange, "Invalid message section: " << section);
}
impl_->rrsets_[section].clear();
if (section == Message::SECTION_QUESTION) {
impl_->questions_.clear();
} else {
impl_->rrsets_[section].clear();
}
impl_->counts_[section] = 0;
}
......
......@@ -295,6 +295,7 @@ class MessageTest(unittest.TestCase):
self.assertEqual(1, self.r.get_rr_count(Message.SECTION_QUESTION))
self.r.clear_section(Message.SECTION_QUESTION)
self.assertEqual(0, self.r.get_rr_count(Message.SECTION_QUESTION))
self.assertEqual(0, len(self.r.get_question()))
def test_clear_section(self):
for section in [Message.SECTION_ANSWER, Message.SECTION_AUTHORITY,
......
......@@ -406,6 +406,8 @@ TEST_F(MessageTest, clearQuestionSection) {
message_render.clearSection(Message::SECTION_QUESTION);
EXPECT_EQ(0, message_render.getRRCount(Message::SECTION_QUESTION));
EXPECT_TRUE(message_render.beginQuestion() ==
message_render.endQuestion());
}
......
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