BIND 10 trac499, updated. 7c419681601df9c3a453f0e46756dd751344b1a8 [trac499] Mischellaneous minor preparator changes
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Feb 24 16:44:29 UTC 2011
The branch, trac499 has been updated
via 7c419681601df9c3a453f0e46756dd751344b1a8 (commit)
via f0dd8824dc9bb06420b960f2842902ca2d63fba3 (commit)
via bb708b6586815ae9ac14d99b0d4bfd714f315273 (commit)
via d3120390ae945b88432c48aa82daf90ef67f6715 (commit)
via 27025d831a4d06672458004ec70b5c2cef73904d (commit)
via 57b77aa7c09f568a9adf7f9ad475cc80f278fedc (commit)
via 14a51327ed408ed5a957147720f7ad3e3db6a95d (commit)
from af01e66fde8c0055319c47d775b0af1408a3e18a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7c419681601df9c3a453f0e46756dd751344b1a8
Author: Stephen Morris <stephen at isc.org>
Date: Thu Feb 24 12:02:59 2011 +0000
[trac499] Mischellaneous minor preparator changes
* Extend logging in IOFetch (and add message definitions)
* Update buffer size setting for UDP socket
* remove spaces at end of lines in other files
commit f0dd8824dc9bb06420b960f2842902ca2d63fba3
Merge: af01e66fde8c0055319c47d775b0af1408a3e18a bb708b6586815ae9ac14d99b0d4bfd714f315273
Author: Stephen Morris <stephen at isc.org>
Date: Thu Feb 24 09:12:45 2011 +0000
Merge branch 'master' into trac499
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 120 +++++++++++++++------------
src/bin/auth/tests/query_unittest.cc | 2 +-
src/lib/asiolink/Makefile.am | 3 +-
src/lib/asiolink/asiodef.cc | 37 ++++++++
src/lib/asiolink/asiodef.h | 21 +++++
src/lib/asiolink/asiodef.msg | 56 +++++++++++++
src/lib/asiolink/asiolink.h | 6 +-
src/lib/asiolink/dns_server.h | 12 ++--
src/lib/asiolink/dns_service.h | 2 +-
src/lib/asiolink/interval_timer.h | 2 +-
src/lib/asiolink/io_address.h | 6 +-
src/lib/asiolink/io_asio_socket.h | 13 +++-
src/lib/asiolink/io_endpoint.h | 6 +-
src/lib/asiolink/io_fetch.cc | 27 +++++--
src/lib/asiolink/io_fetch.h | 20 +++--
src/lib/asiolink/io_message.h | 6 +-
src/lib/asiolink/recursive_query.cc | 4 +-
src/lib/asiolink/tests/Makefile.am | 7 +-
src/lib/asiolink/tests/io_fetch_unittest.cc | 2 +-
src/lib/asiolink/udp_socket.h | 24 ++++--
src/lib/datasrc/data_source.cc | 2 +-
src/lib/datasrc/memory_datasrc.cc | 2 +-
src/lib/nsas/Makefile.am | 1 +
src/lib/nsas/hash_table.h | 24 +----
src/lib/nsas/locks.h | 116 ++++++++++++++++++++++++++
src/lib/nsas/lru_list.h | 24 ++----
src/lib/nsas/nameserver_address_store.cc | 15 +---
src/lib/nsas/nameserver_entry.cc | 2 +-
src/lib/nsas/nameserver_entry.h | 15 +---
src/lib/nsas/tests/nsas_test.h | 1 +
src/lib/nsas/zone_entry.cc | 4 +-
src/lib/nsas/zone_entry.h | 16 +---
32 files changed, 403 insertions(+), 195 deletions(-)
create mode 100644 src/lib/asiolink/asiodef.cc
create mode 100644 src/lib/asiolink/asiodef.h
create mode 100644 src/lib/asiolink/asiodef.msg
create mode 100644 src/lib/nsas/locks.h
-----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 139166b..b02143b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,11 @@ if test $enable_shared = no; then
AC_MSG_ERROR([BIND 10 requires shared libraries to be built])
fi
+AC_ARG_ENABLE(boost-threads,
+AC_HELP_STRING([--enable-boost-threads],
+ [use boost threads. Currently this only means using its locks instead of dummy locks, in the cache and NSAS]),
+ use_boost_threads=$enableval, use_boost_threads=no)
+
# allow configuring without setproctitle.
AC_ARG_ENABLE(setproctitle-check,
AC_HELP_STRING([--disable-setproctitle-check],
@@ -443,62 +448,69 @@ AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp boost/interprocess/sync
CPPFLAGS="$CPPFLAGS_SAVES"
AC_SUBST(BOOST_INCLUDES)
-# Using boost::mutex can result in requiring libboost_thread with older
-# versions of Boost. We'd like to avoid relying on a compiled Boost library
-# whenever possible, so we need to check for it step by step.
-#
-# NOTE: another fix of this problem is to simply require newer versions of
-# boost. If we choose that solution we should simplify the following tricky
-# checks accordingly and all Makefile.am's that refer to NEED_LIBBOOST_THREAD.
-AC_MSG_CHECKING(for boost::mutex)
-CPPFLAGS_SAVES="$CPPFLAGS"
-LIBS_SAVES="$LIBS"
-CPPFLAGS="$BOOST_INCLUDES $CPPFLAGS $MULTITHREADING_FLAG"
-need_libboost_thread=0
-need_sunpro_workaround=0
-AC_TRY_LINK([
-#include <boost/thread.hpp>
-],[
-boost::mutex m;
-],
- [ AC_MSG_RESULT(yes (without libboost_thread)) ],
-
- # there is one specific problem with SunStudio 5.10
- # where including boost/thread causes a compilation failure
- # There is a workaround in boost but it checks the version not being 5.10
- # This will probably be fixed in the future, in which case this
- # is only a temporary workaround
- [ AC_TRY_LINK([
-#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
-#undef __SUNPRO_CC
-#define __SUNPRO_CC 0x5090
-#endif
-#include <boost/thread.hpp>
-],[
-boost::mutex m;
-],
- [ AC_MSG_RESULT(yes (with SUNOS workaround))
- need_sunpro_workaround=1 ],
- [ LIBS=" $LIBS -lboost_thread"
- AC_TRY_LINK([
-#include <boost/thread.hpp>
-],[
-boost::mutex m;
-],
- [ AC_MSG_RESULT(yes (with libboost_thread))
- need_libboost_thread=1 ],
- [ AC_MSG_RESULT(no)
- AC_MSG_ERROR([boost::mutex cannot be linked in this build environment.
-Perhaps you are using an older version of Boost that requires libboost_thread for the mutex support, which does not appear to be available.
-You may want to check the availability of the library or to upgrade Boost.])
- ])])])
-CPPFLAGS="$CPPFLAGS_SAVES"
-LIBS="$LIBS_SAVES"
-AM_CONDITIONAL(NEED_LIBBOOST_THREAD, test $need_libboost_thread = 1)
-if test $need_sunpro_workaround = 1; then
- AC_DEFINE([NEED_SUNPRO_WORKAROUND], [], [Need boost sunstudio workaround])
+
+if test "${use_boost_threads}" = "yes" ; then
+ AC_DEFINE([USE_BOOST_THREADS], [], [Use boost threads])
+
+ # Using boost::mutex can result in requiring libboost_thread with older
+ # versions of Boost. We'd like to avoid relying on a compiled Boost library
+ # whenever possible, so we need to check for it step by step.
+ #
+ # NOTE: another fix of this problem is to simply require newer versions of
+ # boost. If we choose that solution we should simplify the following tricky
+ # checks accordingly and all Makefile.am's that refer to NEED_LIBBOOST_THREAD.
+ AC_MSG_CHECKING(for boost::mutex)
+ CPPFLAGS_SAVES="$CPPFLAGS"
+ LIBS_SAVES="$LIBS"
+ CPPFLAGS="$BOOST_INCLUDES $CPPFLAGS $MULTITHREADING_FLAG"
+ need_libboost_thread=0
+ need_sunpro_workaround=0
+ AC_TRY_LINK([
+ #include <boost/thread.hpp>
+ ],[
+ boost::mutex m;
+ ],
+ [ AC_MSG_RESULT(yes (without libboost_thread)) ],
+ # there is one specific problem with SunStudio 5.10
+ # where including boost/thread causes a compilation failure
+ # There is a workaround in boost but it checks the version not being 5.10
+ # This will probably be fixed in the future, in which case this
+ # is only a temporary workaround
+ [ AC_TRY_LINK([
+ #if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
+ #undef __SUNPRO_CC
+ #define __SUNPRO_CC 0x5090
+ #endif
+ #include <boost/thread.hpp>
+ ],[
+ boost::mutex m;
+ ],
+ [ AC_MSG_RESULT(yes (with SUNOS workaround))
+ need_sunpro_workaround=1 ],
+ [ LIBS=" $LIBS -lboost_thread"
+ AC_TRY_LINK([
+ #include <boost/thread.hpp>
+ ],[
+ boost::mutex m;
+ ],
+ [ AC_MSG_RESULT(yes (with libboost_thread))
+ need_libboost_thread=1 ],
+ [ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([boost::mutex cannot be linked in this build environment.
+ Perhaps you are using an older version of Boost that requires libboost_thread for the mutex support, which does not appear to be available.
+ You may want to check the availability of the library or to upgrade Boost.])
+ ])])])
+ CPPFLAGS="$CPPFLAGS_SAVES"
+ LIBS="$LIBS_SAVES"
+ AM_CONDITIONAL(NEED_LIBBOOST_THREAD, test $need_libboost_thread = 1)
+ if test $need_sunpro_workaround = 1; then
+ AC_DEFINE([NEED_SUNPRO_WORKAROUND], [], [Need boost sunstudio workaround])
+ fi
+else
+ AM_CONDITIONAL(NEED_LIBBOOST_THREAD, test "${use_boost_threads}" = "yes")
fi
+
#
# Check availability of gtest, which will be used for unit tests.
#
diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc
index 2d3cf03..05dd748 100644
--- a/src/bin/auth/tests/query_unittest.cc
+++ b/src/bin/auth/tests/query_unittest.cc
@@ -201,7 +201,7 @@ MockZone::find(const Name& name, const RRType& type,
// If not found but we have a target, fill it with all RRsets here
if (!found_domain->second.empty() && target != NULL) {
for (found_rrset = found_domain->second.begin();
- found_rrset != found_domain->second.end(); found_rrset++) {
+ found_rrset != found_domain->second.end(); ++found_rrset) {
// Insert RRs under the domain name into target
target->addRRset(
boost::const_pointer_cast<RRset>(found_rrset->second));
diff --git a/src/lib/asiolink/Makefile.am b/src/lib/asiolink/Makefile.am
index b7bf530..71d31f9 100644
--- a/src/lib/asiolink/Makefile.am
+++ b/src/lib/asiolink/Makefile.am
@@ -50,7 +50,8 @@ if USE_CLANGPP
libasiolink_la_CXXFLAGS += -Wno-error
endif
libasiolink_la_CPPFLAGS = $(AM_CPPFLAGS)
-libasiolink_la_LIBADD = $(top_builddir)/src/lib/log/liblog.la
+libasiolink_la_LIBADD =
libasiolink_la_LIBADD += $(top_builddir)/src/lib/resolve/libresolve.la
libasiolink_la_LIBADD += $(top_builddir)/src/lib/cache/libcache.la
libasiolink_la_LIBADD += $(top_builddir)/src/lib/nsas/libnsas.la
+libasiolink_la_LIBADD += $(top_builddir)/src/lib/log/liblog.la
diff --git a/src/lib/asiolink/asiodef.cc b/src/lib/asiolink/asiodef.cc
new file mode 100644
index 0000000..5f7a02a
--- /dev/null
+++ b/src/lib/asiolink/asiodef.cc
@@ -0,0 +1,37 @@
+// File created from asiodef.msg on Thu Feb 24 11:52:42 2011
+
+#include <cstddef>
+#include <log/message_types.h>
+#include <log/message_initializer.h>
+
+namespace asiolink {
+
+extern const isc::log::MessageID ASIO_FETCHCOMP = "FETCHCOMP";
+extern const isc::log::MessageID ASIO_FETCHSTOP = "FETCHSTOP";
+extern const isc::log::MessageID ASIO_OPENSOCK = "OPENSOCK";
+extern const isc::log::MessageID ASIO_RECVSOCK = "RECVSOCK";
+extern const isc::log::MessageID ASIO_RECVTMO = "RECVTMO";
+extern const isc::log::MessageID ASIO_SENDSOCK = "SENDSOCK";
+extern const isc::log::MessageID ASIO_UNKORIGIN = "UNKORIGIN";
+extern const isc::log::MessageID ASIO_UNKRESULT = "UNKRESULT";
+
+} // namespace asiolink
+
+namespace {
+
+const char* values[] = {
+ "FETCHCOMP", "upstream fetch to %s has now completed",
+ "FETCHSTOP", "upstream fetch to %s has been stopped",
+ "OPENSOCK", "error %d opening %s socket to %s",
+ "RECVSOCK", "error %d reading data from %s via a %s socket",
+ "RECVTMO", "receive timeout while waiting for data from %s",
+ "SENDSOCK", "error %d sending data to %s via a %s socket",
+ "UNKORIGIN", "unknown origin for ASIO error code %d (protocol: %s, address %s)",
+ "UNKRESULT", "unknown result (%d) when IOFetch::stop() was executed for I/O to %s",
+ NULL
+};
+
+const isc::log::MessageInitializer initializer(values);
+
+} // Anonymous namespace
+
diff --git a/src/lib/asiolink/asiodef.h b/src/lib/asiolink/asiodef.h
new file mode 100644
index 0000000..c36026e
--- /dev/null
+++ b/src/lib/asiolink/asiodef.h
@@ -0,0 +1,21 @@
+// File created from asiodef.msg on Thu Feb 24 11:52:42 2011
+
+#ifndef __ASIODEF_H
+#define __ASIODEF_H
+
+#include <log/message_types.h>
+
+namespace asiolink {
+
+extern const isc::log::MessageID ASIO_FETCHCOMP;
+extern const isc::log::MessageID ASIO_FETCHSTOP;
+extern const isc::log::MessageID ASIO_OPENSOCK;
+extern const isc::log::MessageID ASIO_RECVSOCK;
+extern const isc::log::MessageID ASIO_RECVTMO;
+extern const isc::log::MessageID ASIO_SENDSOCK;
+extern const isc::log::MessageID ASIO_UNKORIGIN;
+extern const isc::log::MessageID ASIO_UNKRESULT;
+
+} // namespace asiolink
+
+#endif // __ASIODEF_H
diff --git a/src/lib/asiolink/asiodef.msg b/src/lib/asiolink/asiodef.msg
new file mode 100644
index 0000000..2e9de05
--- /dev/null
+++ b/src/lib/asiolink/asiodef.msg
@@ -0,0 +1,56 @@
+# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+$PREFIX ASIO_
+$NAMESPACE asiolink
+
+FETCHCOMP upstream fetch to %s has now completed
++ A debug message, this records the the upstream fetch (a query made by the
++ resolver on behalf of its client) to the specified address has completed.
+
+FETCHSTOP upstream fetch to %s has been stopped
++ An external component has requested the halting of an upstream fetch. This
++ is an allowed operation, and the message should only appear if debug is
++ enabled.
+
+OPENSOCK error %d opening %s socket to %s
++ The asynchronous I/O code encountered an error when trying to open a socket
++ of the specified protocol in order to send a message to the target address.
++ The the number of the system error that cause the problem is given in the
++ message.
+
+RECVSOCK error %d reading data from %s via a %s socket
++ The asynchronous I/O code encountered an error when trying read data from
++ the specified address on the given protocol. The the number of the system
++ error that cause the problem is given in the message.
+
+SENDSOCK error %d sending data to %s via a %s socket
++ The asynchronous I/O code encountered an error when trying send data to
++ the specified address on the given protocol. The the number of the system
++ error that cause the problem is given in the message.
+
+RECVTMO receive timeout while waiting for data from %s
++ An upstream fetch from the specified address timed out. This may happen for
++ any number of reasons and is most probably a problem at the remote server
++ or a problem on the network. The message will only appear if debug is
++ enabled.
+
+UNKORIGIN unknown origin for ASIO error code %d (protocol: %s, address %s)
++ This message should not appear and indicates an internal error if it does.
++ Please enter a bug report.
+
+UNKRESULT unknown result (%d) when IOFetch::stop() was executed for I/O to %s
++ The termination method of the resolver's upstream fetch class was called with
++ an unknown result code (which is given in the message). This message should
++ not appear and may indicate an internal error. Please enter a bug report.
diff --git a/src/lib/asiolink/asiolink.h b/src/lib/asiolink/asiolink.h
index 03951ae..86c55dc 100644
--- a/src/lib/asiolink/asiolink.h
+++ b/src/lib/asiolink/asiolink.h
@@ -84,8 +84,4 @@
/// the placeholder of callback handlers:
/// http://think-async.com/Asio/asio-1.3.1/doc/asio/reference/asio_handler_allocate.html
-#endif // __ASIOLINK_H
-
-// Local Variables:
-// mode: c++
-// End:
+#endif // __ASIOLINK_H
\ No newline at end of file
diff --git a/src/lib/asiolink/dns_server.h b/src/lib/asiolink/dns_server.h
index 6545275..3d79ebd 100644
--- a/src/lib/asiolink/dns_server.h
+++ b/src/lib/asiolink/dns_server.h
@@ -21,7 +21,7 @@ namespace asiolink {
/// \brief The \c DNSServer class is a wrapper (and base class) for
/// classes which provide DNS server functionality.
-///
+///
/// The classes derived from this one, \c TCPServer and \c UDPServer,
/// act as the interface layer between clients sending queries, and
/// functions defined elsewhere that provide answers to those queries.
@@ -42,10 +42,10 @@ namespace asiolink {
/// when "forking", and that instances will be posted as ASIO handler
/// objects, which are always copied.
///
-/// Because these objects are frequently copied, it is recommended
+/// Because these objects are frequently copied, it is recommended
/// that derived classes be kept small to reduce copy overhead.
class DNSServer {
-protected:
+protected:
///
/// \name Constructors and destructors
///
@@ -66,7 +66,7 @@ public:
/// the ones in the derived class. This makes it possible to pass
/// instances of derived classes as references to this base class
/// without losing access to derived class data.
- ///
+ ///
//@{
/// \brief The funtion operator
virtual void operator()(asio::error_code ec = asio::error_code(),
@@ -75,7 +75,7 @@ public:
(*self_)(ec, length);
}
- /// \brief Resume processing of the server coroutine after an
+ /// \brief Resume processing of the server coroutine after an
/// asynchronous call (e.g., to the DNS Lookup provider) has completed.
///
/// \param done If true, this signals the system there is an answer
@@ -84,7 +84,7 @@ public:
/// \brief Indicate whether the server is able to send an answer
/// to a query.
- ///
+ ///
/// This is presently used only for testing purposes.
virtual bool hasAnswer() { return (self_->hasAnswer()); }
diff --git a/src/lib/asiolink/dns_service.h b/src/lib/asiolink/dns_service.h
index 84aa5fb..e1583c0 100644
--- a/src/lib/asiolink/dns_service.h
+++ b/src/lib/asiolink/dns_service.h
@@ -26,13 +26,13 @@ class DNSLookup;
class DNSAnswer;
class DNSServiceImpl;
+/// \brief Handle DNS Queries
///
/// DNSService is the service that handles DNS queries and answers with
/// a given IOService. This class is mainly intended to hold all the
/// logic that is shared between the authoritative and the recursive
/// server implementations. As such, it handles asio, including config
/// updates (through the 'Checkinprovider'), and listening sockets.
-///
class DNSService {
///
/// \name Constructors and Destructor
diff --git a/src/lib/asiolink/interval_timer.h b/src/lib/asiolink/interval_timer.h
index d805cd7..6c43327 100644
--- a/src/lib/asiolink/interval_timer.h
+++ b/src/lib/asiolink/interval_timer.h
@@ -37,7 +37,7 @@ struct IntervalTimerImpl;
/// The function calls the call back function set by \c setup() and updates
/// the timer to expire in (now + interval) milliseconds.
/// The type of call back function is \c void(void).
-///
+///
/// The call back function will not be called if the instance of this class is
/// destroyed before the timer is expired.
///
diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h
index 0d2787f..07caafe 100644
--- a/src/lib/asiolink/io_address.h
+++ b/src/lib/asiolink/io_address.h
@@ -120,8 +120,4 @@ private:
};
} // asiolink
-#endif // __IO_ADDRESS_H
-
-// Local Variables:
-// mode: c++
-// End:
+#endif // __IO_ADDRESS_H
\ No newline at end of file
diff --git a/src/lib/asiolink/io_asio_socket.h b/src/lib/asiolink/io_asio_socket.h
index eae9b32..d485610 100644
--- a/src/lib/asiolink/io_asio_socket.h
+++ b/src/lib/asiolink/io_asio_socket.h
@@ -41,7 +41,14 @@ public:
IOError(file, line, what) {}
};
-
+/// \brief Socket not open
+///
+/// Thrown if attempt to change socket options fails.
+class SocketSetError : public IOError {
+public:
+ SocketSetError(const char* file, size_t line, const char* what) :
+ IOError(file, line, what) {}
+};
/// Forward declaration of an IOEndpoint
class IOEndpoint;
@@ -276,7 +283,9 @@ public:
/// \param cumulative Unused
/// \param endpoint Unused
/// \param callback Unused
- virtual void asyncReceive(void* data, size_t, size_t, IOEndpoint*, C&) { }
+ virtual void asyncReceive(void* data, size_t, size_t, IOEndpoint*, C&) {
+ }
+
/// \brief Checks if the data received is complete.
///
/// \param data Unused
diff --git a/src/lib/asiolink/io_endpoint.h b/src/lib/asiolink/io_endpoint.h
index 62b9e47..20bf0f8 100644
--- a/src/lib/asiolink/io_endpoint.h
+++ b/src/lib/asiolink/io_endpoint.h
@@ -115,8 +115,4 @@ public:
};
} // asiolink
-#endif // __IO_ENDPOINT_H
-
-// Local Variables:
-// mode: c++
-// End:
+#endif // __IO_ENDPOINT_H
\ No newline at end of file
diff --git a/src/lib/asiolink/io_fetch.cc b/src/lib/asiolink/io_fetch.cc
index 307ae8f..7fce607 100644
--- a/src/lib/asiolink/io_fetch.cc
+++ b/src/lib/asiolink/io_fetch.cc
@@ -46,7 +46,7 @@ isc::log::Logger logger("asio");
/// IOFetch Constructor - just initialize the private data
-IOFetch::IOFetch(int protocol, IOService& service,
+IOFetch::IOFetch(Protocol protocol, IOService& service,
const isc::dns::Question& question, const IOAddress& address, uint16_t port,
isc::dns::OutputBufferPtr& buff, Callback* cb, int wait)
:
@@ -140,6 +140,7 @@ IOFetch::operator()(error_code ec, size_t length) {
data_->buffer->writeData(data_->data.get(), length);
// Finished with this socket, so close it.
+ data_->origin = CLOSE;
data_->socket->close();
/// We are done
@@ -170,9 +171,14 @@ IOFetch::stop(Result result) {
// variable should be done inside a mutex (and the stopped_ variable
// declared as "volatile").
//
+ // The numeric arguments indicate the debug level, with the lower
+ // numbers indicating the most important information. The relative
+ // values are somewhat arbitrary.
+ //
// Although Logger::debug checks the debug flag internally, doing it
- // in below avoids the overhead of a string conversion in the common
- // case when debug is not enabled.
+ // below before calling Logger::debug avoids the overhead of a string
+ // conversion in the common paths and in the common case when debug is
+ // not enabled.
//
// TODO: Update testing of stopped_ if threads are used.
data_->stopped = true;
@@ -185,15 +191,24 @@ IOFetch::stop(Result result) {
}
break;
- case STOPPED:
+ case SUCCESS:
if (logger.isDebugEnabled(50)) {
- logger.debug(50, ASIO_FETCOMP,
+ logger.debug(50, ASIO_FETCHCOMP,
data_->remote->getAddress().toText().c_str());
}
break;
+ case STOPPED:
+ // Fetch has been stopped for some other reason. This is
+ // allowed but as it is unusual it is logged, but with a lower
+ // debug level than a timeout (which is totally normal).
+ logger.debug(10, ASIO_FETCHSTOP,
+ data_->remote->getAddress().toText().c_str());
+ break;
+
default:
- logger.error(ASIO_UNKRESULT, static_cast<int>(result));
+ logger.error(ASIO_UNKRESULT, static_cast<int>(result),
+ data_->remote->getAddress().toText().c_str());
}
// Stop requested, cancel and I/O's on the socket and shut it down,
diff --git a/src/lib/asiolink/io_fetch.h b/src/lib/asiolink/io_fetch.h
index 957831d..369e057 100644
--- a/src/lib/asiolink/io_fetch.h
+++ b/src/lib/asiolink/io_fetch.h
@@ -51,6 +51,12 @@ namespace asiolink {
class IOFetch : public coroutine {
public:
+ /// \brief Protocol to use on the fetch
+ enum Protocol {
+ UDP = 0,
+ TCP = 1
+ };
+
/// \brief Origin of Asynchronous I/O Call
///
/// Indicates what initiated an asynchronous I/O call and used in deciding
@@ -149,7 +155,7 @@ public:
///
/// Just fills in the data members of the IOFetchData structure
///
- /// \param proto either IPPROTO_UDP or IPPROTO_TCP
+ /// \param proto Protocol: either IOFetch::TCP or IOFetch::UDP
/// \param service I/O Service object to handle the asynchronous
/// operations.
/// \param query DNS question to send to the upstream server.
@@ -163,18 +169,18 @@ public:
/// \param wait Timeout for the fetch (in ms).
///
/// TODO: May need to alter constructor (see comment 4 in Trac ticket #554)
- IOFetchData(int proto, IOService& service,
+ IOFetchData(Protocol proto, IOService& service,
const isc::dns::Question& query, const IOAddress& address,
uint16_t port, isc::dns::OutputBufferPtr& buff, Callback* cb,
int wait)
:
- socket((proto == IPPROTO_UDP) ?
+ socket((proto == UDP) ?
static_cast<IOAsioSocket<IOFetch>*>(
new UDPSocket<IOFetch>(service)) :
static_cast<IOAsioSocket<IOFetch>*>(
new TCPSocket<IOFetch>(service))
),
- remote((proto == IPPROTO_UDP) ?
+ remote((proto == UDP) ?
static_cast<IOEndpoint*>(new UDPEndpoint(address, port)) :
static_cast<IOEndpoint*>(new TCPEndpoint(address, port))
),
@@ -197,7 +203,7 @@ public:
///
/// TODO: Need to randomise the source port
///
- /// \param protocol Fetch protocol, either IPPROTO_UDP or IPPROTO_TCP
+ /// \param protocol Fetch protocol, either IOFetch::TCP or IOFetch::UDP
/// \param service I/O Service object to handle the asynchronous
/// operations.
/// \param question DNS question to send to the upstream server.
@@ -211,11 +217,11 @@ public:
/// (default = 53)
/// \param wait Timeout for the fetch (in ms). The default value of
/// -1 indicates no timeout.
- IOFetch(int protocol, IOService& service,
+ IOFetch(Protocol protocol, IOService& service,
const isc::dns::Question& question, const IOAddress& address,
uint16_t port, isc::dns::OutputBufferPtr& buff, Callback* cb,
int wait = -1);
-
+
/// \brief Coroutine entry point
///
/// The operator() method is the method in which the coroutine code enters
diff --git a/src/lib/asiolink/io_message.h b/src/lib/asiolink/io_message.h
index 532f449..dac380d 100644
--- a/src/lib/asiolink/io_message.h
+++ b/src/lib/asiolink/io_message.h
@@ -97,8 +97,4 @@ private:
} // asiolink
-#endif // __IO_MESSAGE_H
-
-// Local Variables:
-// mode: c++
-// End:
+#endif // __IO_MESSAGE_H
\ No newline at end of file
diff --git a/src/lib/asiolink/recursive_query.cc b/src/lib/asiolink/recursive_query.cc
index 5b767a8..0ea8f0e 100644
--- a/src/lib/asiolink/recursive_query.cc
+++ b/src/lib/asiolink/recursive_query.cc
@@ -163,7 +163,7 @@ private:
int serverIndex = rand() % uc;
dlog("Sending upstream query (" + question_.toText() +
") to " + upstream_->at(serverIndex).first);
- IOFetch query(IPPROTO_UDP, io_, question_,
+ IOFetch query(IOFetch::UDP, io_, question_,
upstream_->at(serverIndex).first,
upstream_->at(serverIndex).second, buffer_, this,
query_timeout_);
@@ -173,7 +173,7 @@ private:
int serverIndex = rand() % zs;
dlog("Sending query to zone server (" + question_.toText() +
") to " + zone_servers_.at(serverIndex).first);
- IOFetch query(IPPROTO_IDP, io_, question_,
+ IOFetch query(IOFetch::UDP, io_, question_,
zone_servers_.at(serverIndex).first,
zone_servers_.at(serverIndex).second, buffer_, this,
query_timeout_);
diff --git a/src/lib/asiolink/tests/Makefile.am b/src/lib/asiolink/tests/Makefile.am
index d475278..ff4a745 100644
--- a/src/lib/asiolink/tests/Makefile.am
+++ b/src/lib/asiolink/tests/Makefile.am
@@ -32,12 +32,13 @@ run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDADD = $(GTEST_LDADD)
run_unittests_LDADD += $(SQLITE_LIBS)
-run_unittests_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
-run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
+run_unittests_LDADD += $(top_builddir)/src/lib/dns/libdns++.la
run_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libasiolink.la
-run_unittests_LDADD += $(top_builddir)/src/lib/log/liblog.la
+run_unittests_LDADD += $(top_builddir)/src/lib/resolve/libresolve.la
run_unittests_LDADD += $(top_builddir)/src/lib/cache/libcache.la
run_unittests_LDADD += $(top_builddir)/src/lib/nsas/libnsas.la
+run_unittests_LDADD += $(top_builddir)/src/lib/log/liblog.la
+run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) $(LOG4CXX_LDFLAGS)
diff --git a/src/lib/asiolink/tests/io_fetch_unittest.cc b/src/lib/asiolink/tests/io_fetch_unittest.cc
index 57f61b2..d21f03f 100644
--- a/src/lib/asiolink/tests/io_fetch_unittest.cc
+++ b/src/lib/asiolink/tests/io_fetch_unittest.cc
@@ -66,7 +66,7 @@ public:
run_(false),
question_(Name("example.net"), RRClass::IN(), RRType::A()),
buff_(new OutputBuffer(512)),
- udp_fetch_(IPPROTO_UDP, service_, question_, IOAddress(TEST_HOST),
+ udp_fetch_(IOFetch::UDP, service_, question_, IOAddress(TEST_HOST),
TEST_PORT, buff_, this, 100)
// tcp_fetch_(service_, question_, IOAddress(TEST_HOST), TEST_PORT,
// buff_, this, 100, IPPROTO_UDP)
diff --git a/src/lib/asiolink/udp_socket.h b/src/lib/asiolink/udp_socket.h
index 8cb2232..56a9bb0 100644
--- a/src/lib/asiolink/udp_socket.h
+++ b/src/lib/asiolink/udp_socket.h
@@ -28,7 +28,6 @@
#include <config.h>
-
#include <asiolink/io_asio_socket.h>
#include <asiolink/io_endpoint.h>
#include <asiolink/io_service.h>
@@ -51,7 +50,7 @@ public:
enum {
MAX_SIZE = 4096 // Send and receive size
};
-
+
/// \brief Constructor from an ASIO UDP socket.
///
/// \param socket The ASIO representation of the UDP socket. It
@@ -201,12 +200,23 @@ UDPSocket<C>::open(const IOEndpoint* endpoint, C&) {
isopen_ = true;
// Ensure it can send and receive 4K buffers.
- socket_.set_option(asio::socket_base::send_buffer_size(MAX_SIZE));
- socket_.set_option(asio::socket_base::receive_buffer_size(MAX_SIZE));
- ;
- // Allow reuse of an existing port/address
- socket_.set_option(asio::socket_base::reuse_address(true));
+
+ asio::ip::udp::socket::send_buffer_size snd_size;
+ socket_.get_option(snd_size);
+ if (snd_size.value() < MAX_SIZE) {
+ snd_size = MAX_SIZE;
+ socket_.set_option(snd_size);
+ }
+
+ asio::ip::udp::socket::receive_buffer_size rcv_size;
+ socket_.get_option(rcv_size);
+ if (rcv_size.value() < MAX_SIZE) {
+ rcv_size = MAX_SIZE;
+ socket_.set_option(rcv_size);
+ }
}
+
+ // Nothing was done asynchronously, so tell the caller that.
return (false);
}
diff --git a/src/lib/datasrc/data_source.cc b/src/lib/datasrc/data_source.cc
index 8b2b47e..829d1fc 100644
--- a/src/lib/datasrc/data_source.cc
+++ b/src/lib/datasrc/data_source.cc
@@ -1157,7 +1157,7 @@ MetaDataSrc::addDataSrc(ConstDataSrcPtr data_src) {
void
MetaDataSrc::removeDataSrc(ConstDataSrcPtr data_src) {
std::vector<ConstDataSrcPtr>::iterator it, itr;
- for (it = data_sources.begin(); it != data_sources.end(); it++) {
+ for (it = data_sources.begin(); it != data_sources.end(); ++it) {
if (*it == data_src) {
itr = it;
}
diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc
index bbc5166..bf3c8ca 100644
--- a/src/lib/datasrc/memory_datasrc.cc
+++ b/src/lib/datasrc/memory_datasrc.cc
@@ -515,7 +515,7 @@ struct MemoryZone::MemoryZoneImpl {
if (target != NULL && !node->getData()->empty()) {
// Empty domain will be handled as NXRRSET by normal processing
for (found = node->getData()->begin();
- found != node->getData()->end(); found++)
+ found != node->getData()->end(); ++found)
{
target->addRRset(
boost::const_pointer_cast<RRset>(prepareRRset(name,
diff --git a/src/lib/nsas/Makefile.am b/src/lib/nsas/Makefile.am
index a88bd22..04a765b 100644
--- a/src/lib/nsas/Makefile.am
+++ b/src/lib/nsas/Makefile.am
@@ -25,6 +25,7 @@ libnsas_la_SOURCES += asiolink.h
libnsas_la_SOURCES += hash.cc hash.h
libnsas_la_SOURCES += hash_deleter.h
libnsas_la_SOURCES += hash_key.cc hash_key.h
+libnsas_la_SOURCES += locks.h
libnsas_la_SOURCES += hash_table.h
libnsas_la_SOURCES += lru_list.h
libnsas_la_SOURCES += nameserver_address_store.cc nameserver_address_store.h
diff --git a/src/lib/nsas/hash_table.h b/src/lib/nsas/hash_table.h
index 3c34ee9..e46d687 100644
--- a/src/lib/nsas/hash_table.h
+++ b/src/lib/nsas/hash_table.h
@@ -15,25 +15,11 @@
#ifndef __HASH_TABLE_H
#define __HASH_TABLE_H
-// Workaround for a problem with boost and sunstudio 5.10
-// There is a version check in there that appears wrong,
-// which makes including boost/thread.hpp fail
-// This will probably be fixed in a future version of boost,
-// in which case this part can be removed then
-#ifdef NEED_SUNPRO_WORKAROUND
-#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
-#undef __SUNPRO_CC
-#define __SUNPRO_CC 0x5090
-#endif
-#endif // NEED_SUNPRO_WORKAROUND
+#include <list>
#include <boost/shared_ptr.hpp>
-#include <boost/thread.hpp>
-#include <boost/interprocess/sync/sharable_lock.hpp>
-#include <boost/interprocess/sync/scoped_lock.hpp>
-#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
-#include <list>
+#include "locks.h"
#include "hash.h"
#include "hash_key.h"
@@ -61,7 +47,7 @@ struct HashTableSlot {
typedef typename std::list<boost::shared_ptr<T> >::iterator iterator;
///< Iterator over elements with same hash
- typedef boost::interprocess::interprocess_upgradable_mutex mutex_type;
+ typedef isc::locks::upgradable_mutex mutex_type;
///< Mutex protecting this slot
//@}
@@ -128,11 +114,11 @@ public:
///
//@{
typedef typename
- boost::interprocess::sharable_lock<typename HashTableSlot<T>::mutex_type>
+ isc::locks::sharable_lock<typename HashTableSlot<T>::mutex_type>
sharable_lock; ///< Type for a scope-limited read-lock
typedef typename
- boost::interprocess::scoped_lock<typename HashTableSlot<T>::mutex_type>
+ isc::locks::scoped_lock<typename HashTableSlot<T>::mutex_type>
scoped_lock; ///< Type for a scope-limited write-lock
//@}
diff --git a/src/lib/nsas/locks.h b/src/lib/nsas/locks.h
new file mode 100644
index 0000000..98197c3
--- /dev/null
+++ b/src/lib/nsas/locks.h
@@ -0,0 +1,116 @@
+// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+/// This file (right now) provides dummy locks
+/// It also contains code to use boost/threads locks:
+///
+/// if USE_BOOST_THREADS is defined, we typedef the relevant classes
+/// and derive from the relevant templates so our dummy locks are
+/// replaced by the boost locks (--enable-boost-threads)
+///
+/// If USE_BOOST_THREADS is NOT defined, all locks are dummy classes
+/// that don't actually do anything. At this moment, only the very
+/// minimal set of methods that we actually use is defined.
+///
+/// Note that we need to include <config.h> in our .cc files for that
+/// to be set. we might want to enfore this at compile time with a check
+/// (TODO)
+/// Note that this also contains a workaround for Sunstudio; which
+/// probably won't completely work right now (that is, if the TODO
+/// above is completed), since that would also require some changes
+/// in most (at first glance unrelated) Makefiles
+/// (TODO2)
+
+#ifndef __LOCKS_
+#define __LOCKS_
+
+#ifndef USE_BOOST_THREADS
+
+namespace isc {
+namespace locks {
+
+class mutex {
+};
+
+class recursive_mutex {
+};
+
+class upgradable_mutex {
+};
+
+template <typename T>
+class sharable_lock {
+public:
+ sharable_lock(T) { }
+};
+
+template <typename T>
+class scoped_lock {
+public:
+ scoped_lock(T) { }
+
+ void lock() {}
+ void unlock() {}
+};
+
+}
+}
+
+#else // USE_BOOST_THREADS
+
+// Workaround for a problem with boost and sunstudio 5.10
+// There is a version check in there that appears wrong,
+// which makes including boost/thread.hpp fail
+// This will probably be fixed in a future version of boost,
+// in which case this part can be removed then
+#ifdef NEED_SUNPRO_WORKAROUND
+#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
+#undef __SUNPRO_CC
+#define __SUNPRO_CC 0x5090
+#endif
+#endif // NEED_SUNPRO_WORKAROUND
+
+#include <boost/thread.hpp>
+#include <boost/interprocess/sync/sharable_lock.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
+
+namespace isc {
+namespace locks {
+
+typedef boost::mutex mutex;
+typedef boost::interprocess::interprocess_upgradable_mutex upgradable_mutex;
+typedef boost::interprocess::interprocess_recursive_mutex recursive_mutex;
+
+template <typename T>
+struct sharable_lock : public boost::interprocess::sharable_lock<T> {
+public:
+ sharable_lock(T& mtype) : boost::interprocess::sharable_lock<T>(mtype) {}
+};
+
+
+template <class T>
+struct scoped_lock : public boost::interprocess::scoped_lock<T> {
+public:
+ scoped_lock(T& mtype) : boost::interprocess::scoped_lock<T>(mtype) { }
+};
+
+}
+}
+
+
+#endif // USE_BOOST_THREADS
+
+#endif // __LOCKS_
diff --git a/src/lib/nsas/lru_list.h b/src/lib/nsas/lru_list.h
index a3e0974..993eb89 100644
--- a/src/lib/nsas/lru_list.h
+++ b/src/lib/nsas/lru_list.h
@@ -18,22 +18,10 @@
#include <list>
#include <string>
-// Workaround for a problem with boost and sunstudio 5.10
-// There is a version check in there that appears wrong,
-// which makes including boost/thread.hpp fail
-// This will probably be fixed in a future version of boost,
-// in which case this part can be removed then
-#ifdef NEED_SUNPRO_WORKAROUND
-#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
-#undef __SUNPRO_CC
-#define __SUNPRO_CC 0x5090
-#endif
-#endif // NEED_SUNPRO_WORKAROUND
-
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
-#include <boost/thread.hpp>
-#include <boost/interprocess/sync/scoped_lock.hpp>
+
+#include "locks.h"
namespace isc {
namespace nsas {
@@ -151,7 +139,7 @@ public:
}
private:
- boost::mutex mutex_; ///< List protection
+ isc::locks::mutex mutex_; ///< List protection
std::list<boost::shared_ptr<T> > lru_; ///< The LRU list itself
uint32_t max_size_; ///< Max size of the list
uint32_t count_; ///< Count of elements
@@ -163,7 +151,7 @@ template <typename T>
void LruList<T>::add(boost::shared_ptr<T>& element) {
// Protect list against concurrent access
- boost::interprocess::scoped_lock<boost::mutex> lock(mutex_);
+ isc::locks::scoped_lock<isc::locks::mutex> lock(mutex_);
// Add the entry and set its pointer field to point into the list.
// insert() is used to get the pointer.
@@ -212,7 +200,7 @@ void LruList<T>::remove(boost::shared_ptr<T>& element) {
if (element->iteratorValid()) {
// Is valid, so protect list against concurrent access
- boost::interprocess::scoped_lock<boost::mutex> lock(mutex_);
+ isc::locks::scoped_lock<isc::locks::mutex> lock(mutex_);
lru_.erase(element->getLruIterator()); // Remove element from list
element->invalidateIterator(); // Invalidate pointer
@@ -228,7 +216,7 @@ void LruList<T>::touch(boost::shared_ptr<T>& element) {
if (element->iteratorValid()) {
// Protect list against concurrent access
- boost::interprocess::scoped_lock<boost::mutex> lock(mutex_);
+ isc::locks::scoped_lock<isc::locks::mutex> lock(mutex_);
// Move the element to the end of the list.
lru_.splice(lru_.end(), lru_, element->getLruIterator());
diff --git a/src/lib/nsas/nameserver_address_store.cc b/src/lib/nsas/nameserver_address_store.cc
index 0ba9c8e..7bb0eee 100644
--- a/src/lib/nsas/nameserver_address_store.cc
+++ b/src/lib/nsas/nameserver_address_store.cc
@@ -14,20 +14,6 @@
#include <config.h>
-// Workaround for a problem with boost and sunstudio 5.10
-// There is a version check in there that appears wrong,
-// which makes including boost/thread.hpp fail
-// This will probably be fixed in a future version of boost,
-// in which case this part can be removed then
-#ifdef NEED_SUNPRO_WORKAROUND
-#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
-#undef __SUNPRO_CC
-#define __SUNPRO_CC 0x5090
-#endif
-#endif // NEED_SUNPRO_WORKAROUND
-
-
-#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/foreach.hpp>
#include <boost/bind.hpp>
@@ -35,6 +21,7 @@
#include <config.h>
#include <dns/rdataclass.h>
+#include "locks.h"
#include "hash_table.h"
#include "lru_list.h"
#include "hash_deleter.h"
diff --git a/src/lib/nsas/nameserver_entry.cc b/src/lib/nsas/nameserver_entry.cc
index 53f4233..9522e81 100644
--- a/src/lib/nsas/nameserver_entry.cc
+++ b/src/lib/nsas/nameserver_entry.cc
@@ -50,7 +50,7 @@ namespace nsas {
namespace {
// Just shorter type alias
-typedef boost::recursive_mutex::scoped_lock Lock;
+typedef isc::locks::scoped_lock<isc::locks::recursive_mutex> Lock;
}
diff --git a/src/lib/nsas/nameserver_entry.h b/src/lib/nsas/nameserver_entry.h
index 9a8e542..c3ddcd4 100644
--- a/src/lib/nsas/nameserver_entry.h
+++ b/src/lib/nsas/nameserver_entry.h
@@ -15,21 +15,8 @@
#ifndef __NAMESERVER_ENTRY_H
#define __NAMESERVER_ENTRY_H
-// Workaround for a problem with boost and sunstudio 5.10
-// There is a version check in there that appears wrong,
-// which makes including boost/thread.hpp fail
-// This will probably be fixed in a future version of boost,
-// in which case this part can be removed then
-#ifdef NEED_SUNPRO_WORKAROUND
-#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
-#undef __SUNPRO_CC
-#define __SUNPRO_CC 0x5090
-#endif
-#endif // NEED_SUNPRO_WORKAROUND
-
#include <string>
#include <vector>
-#include <boost/thread.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <exceptions/exceptions.h>
@@ -252,7 +239,7 @@ public:
//@}
private:
- mutable boost::recursive_mutex mutex_; ///< Mutex protecting this object
+ mutable isc::locks::recursive_mutex mutex_;///< Mutex protecting this object
std::string name_; ///< Canonical name of the nameserver
isc::dns::RRClass classCode_; ///< Class of the nameserver
/**
diff --git a/src/lib/nsas/tests/nsas_test.h b/src/lib/nsas/tests/nsas_test.h
index b4446a4..926e859 100644
--- a/src/lib/nsas/tests/nsas_test.h
+++ b/src/lib/nsas/tests/nsas_test.h
@@ -22,6 +22,7 @@
#include <string>
#include <vector>
+#include <map>
#include <config.h>
diff --git a/src/lib/nsas/zone_entry.cc b/src/lib/nsas/zone_entry.cc
index 395b06c..77f3dad 100644
--- a/src/lib/nsas/zone_entry.cc
+++ b/src/lib/nsas/zone_entry.cc
@@ -12,6 +12,8 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
+#include <map>
+
#include <config.h>
#include "zone_entry.h"
@@ -49,7 +51,7 @@ ZoneEntry::ZoneEntry(
namespace {
// Shorter aliases for frequently used types
-typedef boost::recursive_mutex::scoped_lock Lock; // Local lock, nameservers not locked
+typedef isc::locks::scoped_lock<isc::locks::recursive_mutex> Lock; // Local lock, nameservers not locked
typedef boost::shared_ptr<AddressRequestCallback> CallbackPtr;
/*
diff --git a/src/lib/nsas/zone_entry.h b/src/lib/nsas/zone_entry.h
index c819692..28a42ea 100644
--- a/src/lib/nsas/zone_entry.h
+++ b/src/lib/nsas/zone_entry.h
@@ -15,22 +15,9 @@
#ifndef __ZONE_ENTRY_H
#define __ZONE_ENTRY_H
-// Workaround for a problem with boost and sunstudio 5.10
-// There is a version check in there that appears wrong,
-// which makes including boost/thread.hpp fail
-// This will probably be fixed in a future version of boost,
-// in which case this part can be removed then
-#ifdef NEED_SUNPRO_WORKAROUND
-#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100
-#undef __SUNPRO_CC
-#define __SUNPRO_CC 0x5090
-#endif
-#endif // NEED_SUNPRO_WORKAROUND
-
#include <string>
#include <vector>
#include <set>
-#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
@@ -38,6 +25,7 @@
#include <resolve/resolver_interface.h>
+#include "locks.h"
#include "hash_key.h"
#include "nsas_entry.h"
#include "asiolink.h"
@@ -131,7 +119,7 @@ protected:
time_t expiry_; ///< Expiry time of this entry, 0 means not set
//}@
private:
- mutable boost::recursive_mutex mutex_; ///< Mutex protecting this zone entry
+ mutable isc::locks::recursive_mutex mutex_;///< Mutex protecting this zone entry
std::string name_; ///< Canonical zone name
isc::dns::RRClass class_code_; ///< Class code
/**
More information about the bind10-changes
mailing list