Commit 74e4f864 authored by Scott Mann's avatar Scott Mann
Browse files

[trac554] First pass at tcp support in IOFetchProtocol

parent bc3d1d70
......@@ -581,6 +581,10 @@ public:
InputBuffer ibuf(buffer_->getData(), buffer_->getLength());
incoming.fromWire(ibuf);
if (message->getHeaderFlag(Message::HEADERFLAG_TC) {
}
if (upstream_->size() == 0 &&
incoming.getRcode() == Rcode::NOERROR()) {
done_ = handleRecursiveAnswer(incoming);
......
......@@ -87,8 +87,8 @@ private:
/// 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_;
struct IOFetchProtocol;
boost::shared_ptr<IOFetchProtocol> data_;
};
}
......
......@@ -50,16 +50,16 @@ using namespace isc::dns;
namespace asiolink {
// Private IOFetch data (see internal/udpdns.h for reasons)
struct IOFetch::PrivateData {
// Private IOFetch data (see internal/iofetch.h for reasons)
struct IOFetch::IOFetchProtocol {
// 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::socket tsocket;
// tcp endpoint
//tcp::endpoint tremote;
tcp::endpoint tremote;
// What we ask the server
Question question;
// We will store the answer here
......@@ -78,17 +78,24 @@ struct IOFetch::PrivateData {
// 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,
IOFetchProtocol(io_service& service,
const udp::socket::protocol_type& protocol,
const tcp::socket::protocol_type& tprotocol,
const Question &q,
OutputBufferPtr b, Callback *c) :
socket(service, protocol),
question(q),
buffer(b),
msgbuf(new OutputBuffer(512)),
callback(c),
stopped(false),
timer(service)
{ }
socket(service, protocol),
tsocket(service, tprotocol),
question(q),
buffer(b),
msgbuf(new OutputBuffer(512)),
callback(c),
stopped(false),
timer(service)
{
}
};
/// The following functions implement the \c IOFetch class.
......@@ -97,8 +104,10 @@ struct IOFetch::PrivateData {
IOFetch::IOFetch(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,
data_(new IOFetchProtocol(io_service,
addr.getFamily() == AF_INET ? udp::v4() : udp::v6(),
addr.getFamily() == AF_INET ? tcp::v4() : tcp::v6(),
q, buffer,
callback))
{
data_->remote = UDPEndpoint(addr, port).getASIOEndpoint();
......
Markdown is supported
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