BIND 10 trac499, updated. e321d8b344152b558cb42856deb5e8798f153d1b [trac554]Initial name change from UDPQuery to IOFetch
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Jan 31 11:49:36 UTC 2011
The branch, trac499 has been updated
via e321d8b344152b558cb42856deb5e8798f153d1b (commit)
from 74d131f92fbcd1fe21335a743dde205063b63d00 (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 e321d8b344152b558cb42856deb5e8798f153d1b
Author: Scott Mann <smann at isc.org>
Date: Mon Jan 31 04:46:07 2011 -0700
[trac554]Initial name change from UDPQuery to IOFetch
-----------------------------------------------------------------------
Summary of changes:
src/lib/asiolink/Makefile.am | 2 +-
src/lib/asiolink/asiolink.cc | 2 +-
src/lib/asiolink/internal/{ioquery.h => iofetch.h} | 0
src/lib/asiolink/internal/tests/udpdns_unittest.cc | 2 +-
src/lib/asiolink/{ioquery.cc => iofetch.cc} | 6 +++++-
5 files changed, 8 insertions(+), 4 deletions(-)
rename src/lib/asiolink/internal/{ioquery.h => iofetch.h} (100%)
rename src/lib/asiolink/{ioquery.cc => iofetch.cc} (98%)
-----------------------------------------------------------------------
diff --git a/src/lib/asiolink/Makefile.am b/src/lib/asiolink/Makefile.am
index b2affe1..c879039 100644
--- a/src/lib/asiolink/Makefile.am
+++ b/src/lib/asiolink/Makefile.am
@@ -20,7 +20,7 @@ libasiolink_la_SOURCES += ioendpoint.cc ioendpoint.h
libasiolink_la_SOURCES += udpdns.cc internal/udpdns.h
libasiolink_la_SOURCES += tcpdns.cc internal/tcpdns.h
libasiolink_la_SOURCES += internal/coroutine.h
-libasiolink_la_SOURCES += ioquery.cc internal/ioquery.h
+libasiolink_la_SOURCES += iofetch.cc internal/iofetch.h
# Note: the ordering matters: -Wno-... must follow -Wextra (defined in
# B10_CXXFLAGS)
libasiolink_la_CXXFLAGS = $(AM_CXXFLAGS)
diff --git a/src/lib/asiolink/asiolink.cc b/src/lib/asiolink/asiolink.cc
index 5c18ff8..15235f3 100644
--- a/src/lib/asiolink/asiolink.cc
+++ b/src/lib/asiolink/asiolink.cc
@@ -35,7 +35,7 @@
#include <asiolink/asiolink.h>
#include <asiolink/internal/tcpdns.h>
#include <asiolink/internal/udpdns.h>
-#include <asiolink/internal/ioquery.h>
+#include <asiolink/internal/iofetch.h>
#include <log/dummylog.h>
diff --git a/src/lib/asiolink/internal/iofetch.h b/src/lib/asiolink/internal/iofetch.h
new file mode 100644
index 0000000..7c0a8a0
--- /dev/null
+++ b/src/lib/asiolink/internal/iofetch.h
@@ -0,0 +1,100 @@
+// Copyright (C) 2010 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.
+
+#ifndef __IOQUERY_H
+#define __IOQUERY_H 1
+
+#include <config.h>
+
+#include <asio.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <dns/buffer.h>
+#include <dns/message.h>
+#include <dns/messagerenderer.h>
+
+#include <asiolink/asiolink.h>
+#include <asiolink/internal/coroutine.h>
+
+// This file contains UDP-specific implementations of generic classes
+// defined in asiolink.h. It is *not* intended to be part of the public
+// API.
+
+namespace asiolink {
+//
+// Asynchronous UDP coroutine for upstream queries
+//
+class UDPQuery : public coroutine {
+public:
+ // TODO Maybe this should be more generic than just for UDPQuery?
+ ///
+ /// \brief Result of the query
+ ///
+ /// This is related only to contacting the remote server. If the answer
+ ///indicates error, it is still counted as SUCCESS here, if it comes back.
+ ///
+ enum Result {
+ SUCCESS,
+ TIME_OUT,
+ STOPPED
+ };
+ /// Abstract callback for the UDPQuery.
+ class Callback {
+ public:
+ virtual ~Callback() {}
+
+ /// This will be called when the UDPQuery is completed
+ virtual void operator()(Result result) = 0;
+ };
+ ///
+ /// \brief Constructor.
+ ///
+ /// It creates the query.
+ /// @param callback will be called when we terminate. It is your task to
+ /// delete it if allocated on heap.
+ ///@param timeout in ms.
+ ///
+ explicit UDPQuery(asio::io_service& io_service,
+ const isc::dns::Question& q,
+ const IOAddress& addr, uint16_t port,
+ isc::dns::OutputBufferPtr buffer,
+ Callback* callback, int timeout = -1);
+ void operator()(asio::error_code ec = asio::error_code(),
+ size_t length = 0);
+ /// Terminate the query.
+ void stop(Result reason = STOPPED);
+private:
+ enum { MAX_LENGTH = 4096 };
+
+ ///
+ /// \short Private data
+ ///
+ /// They are not private because of stability of the
+ /// interface (this is private class anyway), but because this class
+ /// will be copyed often (it is used as a coroutine and passed as callback
+ /// to many async_*() functions) and we want keep the same data. Some of
+ /// the data is not copyable too.
+ ///
+ struct PrivateData;
+ boost::shared_ptr<PrivateData> data_;
+};
+}
+
+
+#endif // __IOQUERY_H
+
+// Local Variables:
+// mode: c++
+// End:
diff --git a/src/lib/asiolink/internal/ioquery.h b/src/lib/asiolink/internal/ioquery.h
deleted file mode 100644
index 7c0a8a0..0000000
--- a/src/lib/asiolink/internal/ioquery.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (C) 2010 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.
-
-#ifndef __IOQUERY_H
-#define __IOQUERY_H 1
-
-#include <config.h>
-
-#include <asio.hpp>
-#include <boost/shared_array.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <dns/buffer.h>
-#include <dns/message.h>
-#include <dns/messagerenderer.h>
-
-#include <asiolink/asiolink.h>
-#include <asiolink/internal/coroutine.h>
-
-// This file contains UDP-specific implementations of generic classes
-// defined in asiolink.h. It is *not* intended to be part of the public
-// API.
-
-namespace asiolink {
-//
-// Asynchronous UDP coroutine for upstream queries
-//
-class UDPQuery : public coroutine {
-public:
- // TODO Maybe this should be more generic than just for UDPQuery?
- ///
- /// \brief Result of the query
- ///
- /// This is related only to contacting the remote server. If the answer
- ///indicates error, it is still counted as SUCCESS here, if it comes back.
- ///
- enum Result {
- SUCCESS,
- TIME_OUT,
- STOPPED
- };
- /// Abstract callback for the UDPQuery.
- class Callback {
- public:
- virtual ~Callback() {}
-
- /// This will be called when the UDPQuery is completed
- virtual void operator()(Result result) = 0;
- };
- ///
- /// \brief Constructor.
- ///
- /// It creates the query.
- /// @param callback will be called when we terminate. It is your task to
- /// delete it if allocated on heap.
- ///@param timeout in ms.
- ///
- explicit UDPQuery(asio::io_service& io_service,
- const isc::dns::Question& q,
- const IOAddress& addr, uint16_t port,
- isc::dns::OutputBufferPtr buffer,
- Callback* callback, int timeout = -1);
- void operator()(asio::error_code ec = asio::error_code(),
- size_t length = 0);
- /// Terminate the query.
- void stop(Result reason = STOPPED);
-private:
- enum { MAX_LENGTH = 4096 };
-
- ///
- /// \short Private data
- ///
- /// They are not private because of stability of the
- /// interface (this is private class anyway), but because this class
- /// will be copyed often (it is used as a coroutine and passed as callback
- /// to many async_*() functions) and we want keep the same data. Some of
- /// the data is not copyable too.
- ///
- struct PrivateData;
- boost::shared_ptr<PrivateData> data_;
-};
-}
-
-
-#endif // __IOQUERY_H
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/asiolink/internal/tests/udpdns_unittest.cc b/src/lib/asiolink/internal/tests/udpdns_unittest.cc
index 0368511..1e36e4a 100644
--- a/src/lib/asiolink/internal/tests/udpdns_unittest.cc
+++ b/src/lib/asiolink/internal/tests/udpdns_unittest.cc
@@ -20,7 +20,7 @@
#include <dns/question.h>
#include <asiolink/internal/udpdns.h>
-#include <asiolink/internal/ioquery.h>
+#include <asiolink/internal/iofetch.h>
using namespace asio;
using namespace isc::dns;
diff --git a/src/lib/asiolink/iofetch.cc b/src/lib/asiolink/iofetch.cc
new file mode 100644
index 0000000..668a980
--- /dev/null
+++ b/src/lib/asiolink/iofetch.cc
@@ -0,0 +1,195 @@
+// 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.
+
+#include <config.h>
+
+#include <unistd.h> // for some IPC/network system calls
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include <boost/bind.hpp>
+
+#include <asio.hpp>
+#include <asio/deadline_timer.hpp>
+#include <asio/ip/address.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <dns/buffer.h>
+#include <dns/message.h>
+#include <dns/messagerenderer.h>
+#include <log/dummylog.h>
+#include <dns/opcode.h>
+#include <dns/rcode.h>
+
+#include <asiolink.h>
+#include <internal/coroutine.h>
+#include <internal/udpdns.h>
+#include <internal/tcpdns.h>
+#include <internal/iofetch.h>
+
+using namespace asio;
+using asio::ip::udp;
+using asio::ip::tcp;
+using isc::log::dlog;
+
+using namespace std;
+using namespace isc::dns;
+
+namespace asiolink {
+
+// Private UDPQuery data (see internal/udpdns.h for reasons)
+struct UDPQuery::PrivateData {
+ // UDP Socket we send query to and expect reply from there
+ udp::socket socket;
+ // Where was the query sent
+ udp::endpoint remote;
+ // TCP Socket
+ //tcp::socket tsocket;
+ // tcp endpoint
+ //tcp::endpoint tremote;
+ // What we ask the server
+ Question question;
+ // We will store the answer here
+ OutputBufferPtr buffer;
+ OutputBufferPtr msgbuf;
+ // Temporary buffer for answer
+ boost::shared_array<char> data;
+ // This will be called when the data arrive or timeouts
+ Callback* callback;
+ // Did we already stop operating (data arrived, we timed out, someone
+ // called stop). This can be so when we are cleaning up/there are
+ // still pointers to us.
+ bool stopped;
+ // Timer to measure timeouts.
+ deadline_timer timer;
+ // How many milliseconds are we willing to wait for answer?
+ int timeout;
+
+ PrivateData(io_service& service,
+ const udp::socket::protocol_type& protocol, const Question &q,
+ OutputBufferPtr b, Callback *c) :
+ socket(service, protocol),
+ question(q),
+ buffer(b),
+ msgbuf(new OutputBuffer(512)),
+ callback(c),
+ stopped(false),
+ timer(service)
+ { }
+};
+
+/// The following functions implement the \c UDPQuery class.
+///
+/// The constructor
+UDPQuery::UDPQuery(io_service& io_service,
+ const Question& q, const IOAddress& addr, uint16_t port,
+ OutputBufferPtr buffer, Callback *callback, int timeout) :
+ data_(new PrivateData(io_service,
+ addr.getFamily() == AF_INET ? udp::v4() : udp::v6(), q, buffer,
+ callback))
+{
+ data_->remote = UDPEndpoint(addr, port).getASIOEndpoint();
+ data_->timeout = timeout;
+}
+
+/// The function operator is implemented with the "stackless coroutine"
+/// pattern; see internal/coroutine.h for details.
+void
+UDPQuery::operator()(error_code ec, size_t length) {
+ if (ec || data_->stopped) {
+ return;
+ }
+
+ CORO_REENTER (this) {
+ /// Generate the upstream query and render it to wire format
+ /// This is done in a different scope to allow inline variable
+ /// declarations.
+ {
+ Message msg(Message::RENDER);
+
+ // XXX: replace with boost::random or some other suitable PRNG
+ msg.setQid(0);
+ msg.setOpcode(Opcode::QUERY());
+ msg.setRcode(Rcode::NOERROR());
+ msg.setHeaderFlag(Message::HEADERFLAG_RD);
+ msg.addQuestion(data_->question);
+ MessageRenderer renderer(*data_->msgbuf);
+ msg.toWire(renderer);
+ dlog("Sending " + msg.toText() + " to " +
+ data_->remote.address().to_string());
+ }
+
+
+ // If we timeout, we stop, which will shutdown everything and
+ // cancel all other attempts to run inside the coroutine
+ if (data_->timeout != -1) {
+ data_->timer.expires_from_now(boost::posix_time::milliseconds(
+ data_->timeout));
+ data_->timer.async_wait(boost::bind(&UDPQuery::stop, *this,
+ TIME_OUT));
+ }
+
+ // Begin an asynchronous send, and then yield. When the
+ // send completes, we will resume immediately after this point.
+ CORO_YIELD data_->socket.async_send_to(buffer(data_->msgbuf->getData(),
+ data_->msgbuf->getLength()), data_->remote, *this);
+
+ /// Allocate space for the response. (XXX: This should be
+ /// optimized by maintaining a free list of pre-allocated blocks)
+ data_->data.reset(new char[MAX_LENGTH]);
+
+ /// Begin an asynchronous receive, and yield. When the receive
+ /// completes, we will resume immediately after this point.
+ CORO_YIELD data_->socket.async_receive_from(buffer(data_->data.get(),
+ MAX_LENGTH), data_->remote, *this);
+ // The message is not rendered yet, so we can't print it easilly
+ dlog("Received response from " + data_->remote.address().to_string());
+
+ /// Copy the answer into the response buffer. (XXX: If the
+ /// OutputBuffer object were made to meet the requirements of
+ /// a MutableBufferSequence, then it could be written to directly
+ /// by async_recieve_from() and this additional copy step would
+ /// be unnecessary.)
+ data_->buffer->writeData(data_->data.get(), length);
+
+ /// We are done
+ stop(SUCCESS);
+ }
+}
+
+void
+UDPQuery::stop(Result result) {
+ if (!data_->stopped) {
+ switch (result) {
+ case TIME_OUT:
+ dlog("Query timed out");
+ break;
+ case STOPPED:
+ dlog("Query stopped");
+ break;
+ default:;
+ }
+ data_->stopped = true;
+ data_->socket.cancel();
+ data_->socket.close();
+ data_->timer.cancel();
+ if (data_->callback) {
+ (*data_->callback)(result);
+ }
+ }
+}
+
+}
diff --git a/src/lib/asiolink/ioquery.cc b/src/lib/asiolink/ioquery.cc
deleted file mode 100644
index 08b82f7..0000000
--- a/src/lib/asiolink/ioquery.cc
+++ /dev/null
@@ -1,191 +0,0 @@
-// 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.
-
-#include <config.h>
-
-#include <unistd.h> // for some IPC/network system calls
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <boost/bind.hpp>
-
-#include <asio.hpp>
-#include <asio/deadline_timer.hpp>
-#include <asio/ip/address.hpp>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-
-#include <dns/buffer.h>
-#include <dns/message.h>
-#include <dns/messagerenderer.h>
-#include <log/dummylog.h>
-#include <dns/opcode.h>
-#include <dns/rcode.h>
-
-#include <asiolink.h>
-#include <internal/coroutine.h>
-#include <internal/udpdns.h>
-#include <internal/tcpdns.h>
-#include <internal/ioquery.h>
-
-using namespace asio;
-using asio::ip::udp;
-using asio::ip::tcp;
-using isc::log::dlog;
-
-using namespace std;
-using namespace isc::dns;
-
-namespace asiolink {
-
-// Private UDPQuery data (see internal/udpdns.h for reasons)
-struct UDPQuery::PrivateData {
- // UDP Socket we send query to and expect reply from there
- udp::socket socket;
- // Where was the query sent
- udp::endpoint remote;
- // What we ask the server
- Question question;
- // We will store the answer here
- OutputBufferPtr buffer;
- OutputBufferPtr msgbuf;
- // Temporary buffer for answer
- boost::shared_array<char> data;
- // This will be called when the data arrive or timeouts
- Callback* callback;
- // Did we already stop operating (data arrived, we timed out, someone
- // called stop). This can be so when we are cleaning up/there are
- // still pointers to us.
- bool stopped;
- // Timer to measure timeouts.
- deadline_timer timer;
- // How many milliseconds are we willing to wait for answer?
- int timeout;
-
- PrivateData(io_service& service,
- const udp::socket::protocol_type& protocol, const Question &q,
- OutputBufferPtr b, Callback *c) :
- socket(service, protocol),
- question(q),
- buffer(b),
- msgbuf(new OutputBuffer(512)),
- callback(c),
- stopped(false),
- timer(service)
- { }
-};
-
-/// The following functions implement the \c UDPQuery class.
-///
-/// The constructor
-UDPQuery::UDPQuery(io_service& io_service,
- const Question& q, const IOAddress& addr, uint16_t port,
- OutputBufferPtr buffer, Callback *callback, int timeout) :
- data_(new PrivateData(io_service,
- addr.getFamily() == AF_INET ? udp::v4() : udp::v6(), q, buffer,
- callback))
-{
- data_->remote = UDPEndpoint(addr, port).getASIOEndpoint();
- data_->timeout = timeout;
-}
-
-/// The function operator is implemented with the "stackless coroutine"
-/// pattern; see internal/coroutine.h for details.
-void
-UDPQuery::operator()(error_code ec, size_t length) {
- if (ec || data_->stopped) {
- return;
- }
-
- CORO_REENTER (this) {
- /// Generate the upstream query and render it to wire format
- /// This is done in a different scope to allow inline variable
- /// declarations.
- {
- Message msg(Message::RENDER);
-
- // XXX: replace with boost::random or some other suitable PRNG
- msg.setQid(0);
- msg.setOpcode(Opcode::QUERY());
- msg.setRcode(Rcode::NOERROR());
- msg.setHeaderFlag(Message::HEADERFLAG_RD);
- msg.addQuestion(data_->question);
- MessageRenderer renderer(*data_->msgbuf);
- msg.toWire(renderer);
- dlog("Sending " + msg.toText() + " to " +
- data_->remote.address().to_string());
- }
-
-
- // If we timeout, we stop, which will shutdown everything and
- // cancel all other attempts to run inside the coroutine
- if (data_->timeout != -1) {
- data_->timer.expires_from_now(boost::posix_time::milliseconds(
- data_->timeout));
- data_->timer.async_wait(boost::bind(&UDPQuery::stop, *this,
- TIME_OUT));
- }
-
- // Begin an asynchronous send, and then yield. When the
- // send completes, we will resume immediately after this point.
- CORO_YIELD data_->socket.async_send_to(buffer(data_->msgbuf->getData(),
- data_->msgbuf->getLength()), data_->remote, *this);
-
- /// Allocate space for the response. (XXX: This should be
- /// optimized by maintaining a free list of pre-allocated blocks)
- data_->data.reset(new char[MAX_LENGTH]);
-
- /// Begin an asynchronous receive, and yield. When the receive
- /// completes, we will resume immediately after this point.
- CORO_YIELD data_->socket.async_receive_from(buffer(data_->data.get(),
- MAX_LENGTH), data_->remote, *this);
- // The message is not rendered yet, so we can't print it easilly
- dlog("Received response from " + data_->remote.address().to_string());
-
- /// Copy the answer into the response buffer. (XXX: If the
- /// OutputBuffer object were made to meet the requirements of
- /// a MutableBufferSequence, then it could be written to directly
- /// by async_recieve_from() and this additional copy step would
- /// be unnecessary.)
- data_->buffer->writeData(data_->data.get(), length);
-
- /// We are done
- stop(SUCCESS);
- }
-}
-
-void
-UDPQuery::stop(Result result) {
- if (!data_->stopped) {
- switch (result) {
- case TIME_OUT:
- dlog("Query timed out");
- break;
- case STOPPED:
- dlog("Query stopped");
- break;
- default:;
- }
- data_->stopped = true;
- data_->socket.cancel();
- data_->socket.close();
- data_->timer.cancel();
- if (data_->callback) {
- (*data_->callback)(result);
- }
- }
-}
-
-}
More information about the bind10-changes
mailing list