Commit 5ac7c2d1 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2211] cleanup: removed now-unused stuff: auth_srv mutex, client lists, etc.

parent 2f6a2e48
......@@ -268,27 +268,9 @@ public:
/// The TSIG keyring
const shared_ptr<TSIGKeyRing>* keyring_;
/// The data source client list
DataSrcClientListsPtr datasrc_client_lists_;
/// The data source client list manager
auth::DataSrcClientsMgr datasrc_clients_mgr_;
shared_ptr<ConfigurableClientList> getDataSrcClientList(
const RRClass& rrclass)
{
// TODO: Debug-build only check
if (!mutex_.locked()) {
isc_throw(isc::Unexpected, "Not locked!");
}
const std::map<RRClass, shared_ptr<ConfigurableClientList> >::
const_iterator it(datasrc_client_lists_->find(rrclass));
if (it == datasrc_client_lists_->end()) {
return (shared_ptr<ConfigurableClientList>());
} else {
return (it->second);
}
}
/// Bind the ModuleSpec object in config_session_ with
/// isc:config::ModuleSpec::validateStatistics.
void registerStatisticsValidator();
......@@ -317,8 +299,6 @@ public:
isc::dns::Message& message,
bool done);
mutable util::thread::Mutex mutex_;
private:
bool xfrout_connected_;
AbstractXfroutClient& xfrout_client_;
......@@ -338,8 +318,6 @@ AuthSrvImpl::AuthSrvImpl(AbstractXfroutClient& xfrout_client,
xfrin_session_(NULL),
counters_(),
keyring_(NULL),
datasrc_client_lists_(new std::map<RRClass,
shared_ptr<ConfigurableClientList> >()),
ddns_base_forwarder_(ddns_forwarder),
ddns_forwarder_(NULL),
xfrout_connected_(false),
......@@ -940,26 +918,6 @@ AuthSrv::destroyDDNSForwarder() {
}
}
DataSrcClientListsPtr
AuthSrv::swapDataSrcClientLists(DataSrcClientListsPtr new_lists) {
// TODO: Debug-build only check
if (!impl_->mutex_.locked()) {
isc_throw(isc::Unexpected, "Not locked!");
}
std::swap(new_lists, impl_->datasrc_client_lists_);
return (new_lists);
}
shared_ptr<ConfigurableClientList>
AuthSrv::getDataSrcClientList(const RRClass& rrclass) {
return (impl_->getDataSrcClientList(rrclass));
}
util::thread::Mutex&
AuthSrv::getDataSrcClientListMutex() const {
return (impl_->mutex_);
}
void
AuthSrv::setTCPRecvTimeout(size_t timeout) {
dnss_->setTCPRecvTimeout(timeout);
......
......@@ -310,77 +310,10 @@ public:
/// If there was no forwarder yet, this method does nothing.
void destroyDDNSForwarder();
/// \brief Swap the currently used set of data source client lists with
/// given one.
///
/// The "set" of lists is actually given in the form of map from
/// RRClasses to shared pointers to isc::datasrc::ConfigurableClientList.
///
/// This method returns the swapped set of lists, which was previously
/// used by the server.
///
/// This method is intended to be used by a separate method to update
/// the data source configuration "at once". The caller must hold
/// a lock for the mutex object returned by \c getDataSrcClientListMutex()
/// before calling this method.
///
/// The ownership of the returned pointer is transferred to the caller.
/// The caller is generally expected to release the resources used in
/// the old lists. Note that it could take longer time if some of the
/// data source clients contain a large size of in-memory data.
///
/// The caller can pass a NULL pointer. This effectively disables
/// any data source for the server.
///
/// \param new_lists Shared pointer to a new set of data source client
/// lists.
/// \return The previous set of lists. It can be NULL.
isc::datasrc::DataSrcClientListsPtr
swapDataSrcClientLists(isc::datasrc::DataSrcClientListsPtr new_lists);
/// \brief Returns the currently used client list for the class.
///
/// \param rrclass The class for which to get the list.
/// \return The list, or NULL if no list is set for the class.
boost::shared_ptr<isc::datasrc::ConfigurableClientList>
getDataSrcClientList(const isc::dns::RRClass& rrclass);
/// \brief Return a mutex for the client lists.
///
/// Background loading of data uses threads. Therefore we need to protect
/// the client lists by a mutex, so they don't change (or get destroyed)
/// during query processing. Get (and lock) this mutex whenever you do
/// something with the lists and keep it locked until you finish. This
/// is correct:
/// \code
/// {
/// Mutex::Locker locker(auth->getDataSrcClientListMutex());
/// boost::shared_ptr<isc::datasrc::ConfigurableClientList>
/// list(auth->getDataSrcClientList(RRClass::IN()));
/// // Do some processing here
/// }
/// \endcode
///
/// But this is not (it releases the mutex too soon):
/// \code
/// boost::shared_ptr<isc::datasrc::ConfigurableClientList> list;
/// {
/// Mutex::Locker locker(auth->getDataSrcClientListMutex());
/// list = auth->getDataSrcClientList(RRClass::IN()));
/// }
/// // Do some processing here
/// \endcode
///
/// \note This method is const even if you are allowed to modify
/// (lock) the mutex. It's because locking of the mutex is not really
/// a modification of the server object and it is needed to protect the
/// lists even on read-only operations.
isc::util::thread::Mutex& getDataSrcClientListMutex() const;
/// \brief Sets the timeout for incoming TCP connections
///
/// Incoming TCP connections that have not sent their data
/// withing this time are dropped.
/// within this time are dropped.
///
/// \param timeout The timeout (in milliseconds). If se to
/// zero, no timeouts are used, and the connection will remain
......
......@@ -39,7 +39,6 @@
#include <auth/datasrc_config.h>
#include <util/unittests/mock_socketsession.h>
#include <util/threads/sync.h>
#include <dns/tests/unittest_util.h>
#include <testutils/dnsmessage_test.h>
#include <testutils/srv_test.h>
......
......@@ -16,8 +16,6 @@
#include "datasrc_util.h"
#include <util/threads/sync.h>
#include <auth/auth_srv.h>
#include <auth/command.h>
#include <auth/datasrc_config.h>
......
......@@ -16,7 +16,6 @@
#include <config/tests/fake_session.h>
#include <config/ccsession.h>
#include <util/threads/sync.h>
#include <gtest/gtest.h>
......@@ -78,10 +77,6 @@ datasrcConfigHandler(DatasrcConfigTest* fake_server, const std::string&,
class DatasrcConfigTest : public ::testing::Test {
public:
// These pretend to be the server
isc::util::thread::Mutex& getDataSrcClientListMutex() const {
return (mutex_);
}
void swapDataSrcClientLists(shared_ptr<std::map<dns::RRClass, ListPtr> >
new_lists)
{
......@@ -156,7 +151,6 @@ protected:
const string specfile;
std::map<RRClass, ListPtr> lists_;
string log_;
mutable isc::util::thread::Mutex mutex_;
};
void
......
Supports Markdown
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