scoped_ptr<const IOMessage> query_message;
scoped_ptr<const Client> client;
scoped_ptr<const RequestContext> request;
- ResolverConfig() : dnss(ios, NULL, NULL, NULL) {
+ ResolverConfig() :
+ dnss(ios, NULL, NULL, NULL),
+ sock_requestor_(dnss, address_store_, 53210)
+ {
server.setDNSService(dnss);
- server.setConfigured();
}
const RequestContext& createRequest(const string& source_addr) {
endpoint.reset(IOEndpoint::create(IPPROTO_UDP, IOAddress(source_addr),
acceptor_->listen();
}
+ TCPServer::TCPServer(io_service& io_service, int fd, int af,
+ const SimpleCallback* checkin,
+ const DNSLookup* lookup,
+ const DNSAnswer* answer) :
+ io_(io_service), done_(false),
+ checkin_callback_(checkin), lookup_callback_(lookup),
+ answer_callback_(answer)
+ {
+ if (af != AF_INET && af != AF_INET6) {
+ isc_throw(InvalidParameter, "Address family must be either AF_INET "
+ "or AF_INET6, not " << af);
+ }
+ LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, ASIODNS_FD_ADD_TCP).arg(fd);
+
+ try {
+ acceptor_.reset(new tcp::acceptor(io_service));
+ acceptor_->assign(af == AF_INET6 ? tcp::v6() : tcp::v4(), fd);
+ acceptor_->listen();
+ } catch (const std::exception& exception) {
+ // Whatever the thing throws, it is something from ASIO and we convert
+ // it
+ isc_throw(IOError, exception.what());
+ }
+ }
+
void
-TCPServer::operator()(error_code ec, size_t length) {
+TCPServer::operator()(asio::error_code ec, size_t length) {
/// Because the coroutine reentry block is implemented as
/// a switch statement, inline variable declarations are not
/// permitted. Certain variables used below can be declared here.