|
@@ -32,7 +32,8 @@ using namespace std;
|
|
using namespace MessageUtility;
|
|
using namespace MessageUtility;
|
|
|
|
|
|
MessageCache::MessageCache(boost::shared_ptr<RRsetCache> rrset_cache,
|
|
MessageCache::MessageCache(boost::shared_ptr<RRsetCache> rrset_cache,
|
|
- uint32_t cache_size, uint16_t message_class, boost::shared_ptr<RRsetCache> negative_soa_cache):
|
|
+ uint32_t cache_size, uint16_t message_class,
|
|
|
|
+ boost::shared_ptr<RRsetCache> negative_soa_cache):
|
|
message_class_(message_class),
|
|
message_class_(message_class),
|
|
rrset_cache_(rrset_cache),
|
|
rrset_cache_(rrset_cache),
|
|
negative_soa_cache_(negative_soa_cache),
|
|
negative_soa_cache_(negative_soa_cache),
|
|
@@ -62,12 +63,14 @@ bool
|
|
MessageCache::update(const Message& msg) {
|
|
MessageCache::update(const Message& msg) {
|
|
// If the message is a negative response, but no SOA record is found in
|
|
// If the message is a negative response, but no SOA record is found in
|
|
// the authority section, the message cannot be cached
|
|
// the authority section, the message cannot be cached
|
|
- if (isNegativeResponse(msg) && !hasTheRecordInAuthoritySection(msg, RRType::SOA())){
|
|
+ if (isNegativeResponse(msg) &&
|
|
|
|
+ !hasTheRecordInAuthoritySection(msg, RRType::SOA())){
|
|
return (false);
|
|
return (false);
|
|
}
|
|
}
|
|
|
|
|
|
QuestionIterator iter = msg.beginQuestion();
|
|
QuestionIterator iter = msg.beginQuestion();
|
|
- std::string entry_name = genCacheEntryName((*iter)->getName(), (*iter)->getType());
|
|
+ std::string entry_name = genCacheEntryName((*iter)->getName(),
|
|
|
|
+ (*iter)->getType());
|
|
HashKey entry_key = HashKey(entry_name, RRClass(message_class_));
|
|
HashKey entry_key = HashKey(entry_name, RRClass(message_class_));
|
|
|
|
|
|
// The simplest way to update is removing the old message entry directly.
|
|
// The simplest way to update is removing the old message entry directly.
|
|
@@ -80,7 +83,8 @@ MessageCache::update(const Message& msg) {
|
|
message_lru_.remove(old_msg_entry);
|
|
message_lru_.remove(old_msg_entry);
|
|
}
|
|
}
|
|
|
|
|
|
- MessageEntryPtr msg_entry(new MessageEntry(msg, rrset_cache_, negative_soa_cache_));
|
|
+ MessageEntryPtr msg_entry(new MessageEntry(msg, rrset_cache_,
|
|
|
|
+ negative_soa_cache_));
|
|
message_lru_.add(msg_entry);
|
|
message_lru_.add(msg_entry);
|
|
return (message_table_.add(msg_entry, entry_key, true));
|
|
return (message_table_.add(msg_entry, entry_key, true));
|
|
}
|
|
}
|