[svn] commit: r3692 - in /branches/trac408/src/lib/nsas: nameserver_entry.cc nameserver_entry.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Dec 1 15:05:52 UTC 2010
Author: vorner
Date: Wed Dec 1 15:05:52 2010
New Revision: 3692
Log:
Nameserver entry has expiration time again
Modified:
branches/trac408/src/lib/nsas/nameserver_entry.cc
branches/trac408/src/lib/nsas/nameserver_entry.h
Modified: branches/trac408/src/lib/nsas/nameserver_entry.cc
==============================================================================
--- branches/trac408/src/lib/nsas/nameserver_entry.cc (original)
+++ branches/trac408/src/lib/nsas/nameserver_entry.cc Wed Dec 1 15:05:52 2010
@@ -187,6 +187,8 @@
type_(type)
{ }
virtual void success(shared_ptr<AbstractRRset> response) {
+ time_t now = time(NULL);
+
Lock lock(entry_->mutex_);
vector<AddressEntry> entries;
@@ -199,10 +201,6 @@
return;
}
- /**
- * TODO Move to common function, this is similar to
- * what is in constructor.
- */
RdataIteratorPtr i(response->getRdataIterator());
// TODO Remove at merge with trunk
i->first();
@@ -230,6 +228,14 @@
// Put the addresses there
entry_->address_.insert(entry_->address_.end(),
entries.begin(), entries.end());
+ // Update the expiration time. If it is 0, it means we
+ // did not set it yet, so reset
+ time_t expiration(now + response->getTTL().getValue());
+ if (entry_->expiration_) {
+ entry_->expiration_ = min(entry_->expiration_, expiration);
+ } else {
+ entry_->expiration_ = expiration;
+ }
// Run the right callbacks
dispatchCallbacks(lock);
}
Modified: branches/trac408/src/lib/nsas/nameserver_entry.h
==============================================================================
--- branches/trac408/src/lib/nsas/nameserver_entry.h (original)
+++ branches/trac408/src/lib/nsas/nameserver_entry.h Wed Dec 1 15:05:52 2010
@@ -97,7 +97,8 @@
NameserverEntry(const std::string& name,
const isc::dns::RRClass& class_code) :
name_(name),
- classCode_(class_code)
+ classCode_(class_code),
+ expiration_(0)
{}
/// \brief Return Address
@@ -222,8 +223,7 @@
std::string name_; ///< Canonical name of the nameserver
isc::dns::RRClass classCode_; ///< Class of the nameserver
std::vector<AddressEntry> address_; ///< Set of V4/V6 addresses
- time_t expiration_; ///< Summary expiration time
- time_t last_access_; ///< Last access time to the structure
+ time_t expiration_; ///< Summary expiration time. 0 = unset
// Do we have some addresses already? Do we expect some to come?
// These are set after asking for IP, if NOT_ASKED, they are uninitialized
bool has_address_[ADDR_REQ_MAX], expect_address_[ADDR_REQ_MAX];
More information about the bind10-changes
mailing list