Commit e4c54f13 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

auth and recurse now use these new classes (new IOService and DNSService)

removed a few lines that were commented out


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac383@3306 e5f2f494-b856-4b98-b285-d166d9295462
parent 63e6e8db
......@@ -190,6 +190,8 @@ main(int argc, char* argv[]) {
DNSLookup* lookup = auth_server->getDNSLookupProvider();
DNSAnswer* answer = auth_server->getDNSAnswerProvider();
io_service = new IOService();
DNSService* dns_service;
if (address != NULL) {
// XXX: we can only specify at most one explicit address.
// This also means the server cannot run in the dual address
......@@ -197,11 +199,11 @@ main(int argc, char* argv[]) {
// We don't bother to fix this problem, however. The -a option
// is a short term workaround until we support dynamic listening
// port allocation.
io_service = new IOService(*port, *address,
checkin, lookup, answer);
dns_service = new DNSService(*io_service, *port, *address,
checkin, lookup, answer);
} else {
io_service = new IOService(*port, use_ipv4, use_ipv6,
checkin, lookup, answer);
dns_service = new DNSService(*io_service, *port, use_ipv4,
use_ipv6, checkin, lookup, answer);
}
auth_server->setIOService(*io_service);
cout << "[b10-auth] IOService created." << endl;
......
......@@ -187,6 +187,9 @@ main(int argc, char* argv[]) {
DNSLookup* lookup = recursor->getDNSLookupProvider();
DNSAnswer* answer = recursor->getDNSAnswerProvider();
io_service = new IOService();
DNSService* dns_service;
if (address != NULL) {
// XXX: we can only specify at most one explicit address.
// This also means the server cannot run in the dual address
......@@ -194,13 +197,13 @@ main(int argc, char* argv[]) {
// We don't bother to fix this problem, however. The -a option
// is a short term workaround until we support dynamic listening
// port allocation.
io_service = new IOService(*port, *address,
dns_service = new DNSService(*io_service, *port, *address,
checkin, lookup, answer);
} else {
io_service = new IOService(*port, use_ipv4, use_ipv6,
dns_service = new DNSService(*io_service, *port, use_ipv4, use_ipv6,
checkin, lookup, answer);
}
recursor->setIOService(*io_service);
recursor->setDNSService(*dns_service);
cout << "[b10-recurse] IOService created." << endl;
cc_session = new Session(io_service->get_io_service());
......
......@@ -72,8 +72,8 @@ public:
queryShutdown();
}
void querySetup(IOService& ios) {
rec_query_ = new RecursiveQuery(ios, forward_);
void querySetup(DNSService& dnss) {
rec_query_ = new RecursiveQuery(dnss, forward_);
}
void queryShutdown() {
......@@ -295,10 +295,10 @@ Recursor::~Recursor() {
}
void
Recursor::setIOService(asiolink::IOService& ios) {
Recursor::setDNSService(asiolink::DNSService& dnss) {
impl_->queryShutdown();
impl_->querySetup(ios);
io_ = &ios;
impl_->querySetup(dnss);
dnss_ = &dnss;
}
void
......
......@@ -65,10 +65,10 @@ public:
isc::data::ConstElementPtr updateConfig(isc::data::ConstElementPtr config);
/// \brief Assign an ASIO IO Service queue to this Recursor object
void setIOService(asiolink::IOService& ios);
void setDNSService(asiolink::DNSService& dnss);
/// \brief Return this object's ASIO IO Service queue
asiolink::IOService& getIOService() const { return (*io_); }
asiolink::DNSService& getDNSService() const { return (*dnss_); }
/// \brief Return pointer to the DNS Lookup callback function
asiolink::DNSLookup* getDNSLookupProvider() { return (dns_lookup_); }
......@@ -81,7 +81,7 @@ public:
private:
RecursorImpl* impl_;
asiolink::IOService* io_;
asiolink::DNSService* dnss_;
asiolink::SimpleCallback* checkin_;
asiolink::DNSLookup* dns_lookup_;
asiolink::DNSAnswer* dns_answer_;
......
......@@ -63,16 +63,17 @@ private:
class RecursorTest : public ::testing::Test {
protected:
RecursorTest() : ios(*TEST_PORT, true, false, NULL, NULL, NULL),
server(*DEFAULT_REMOTE_ADDRESS),
request_message(Message::RENDER),
parse_message(new Message(Message::PARSE)),
default_qid(0x1035), opcode(Opcode(Opcode::QUERY())),
qname("www.example.com"),
qclass(RRClass::IN()), qtype(RRType::A()),
io_message(NULL), endpoint(NULL), request_obuffer(0),
request_renderer(request_obuffer),
response_obuffer(new OutputBuffer(0))
RecursorTest() : ios(),
dnss(ios, *TEST_PORT, true, false, NULL, NULL, NULL),
server(*DEFAULT_REMOTE_ADDRESS),
request_message(Message::RENDER),
parse_message(new Message(Message::PARSE)),
default_qid(0x1035), opcode(Opcode(Opcode::QUERY())),
qname("www.example.com"),
qclass(RRClass::IN()), qtype(RRType::A()),
io_message(NULL), endpoint(NULL), request_obuffer(0),
request_renderer(request_obuffer),
response_obuffer(new OutputBuffer(0))
{}
~RecursorTest() {
delete io_message;
......@@ -81,6 +82,7 @@ protected:
MockSession notify_session;
MockServer dnsserv;
IOService ios;
DNSService dnss;
Recursor server;
Message request_message;
MessagePtr parse_message;
......
......@@ -204,24 +204,6 @@ public:
~DNSService();
//@}
/// \brief Start the underlying event loop.
///
/// This method does not return control to the caller until
/// the \c stop() method is called via some handler.
// void run();
/// \brief Run the underlying event loop for a single event.
///
/// This method return control to the caller as soon as the
/// first handler has completed. (If no handlers are ready when
/// it is run, it will block until one is.)
// void run_one();
/// \brief Stop the underlying event loop.
///
/// This will return the control to the caller of the \c run() method.
// void stop();
/// \brief Return the native \c io_service object used in this wrapper.
///
/// This is a short term work around to support other BIND 10 modules
......
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