summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/UnboundDomainNameResolver.cpp')
-rw-r--r--Swiften/Network/UnboundDomainNameResolver.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/Swiften/Network/UnboundDomainNameResolver.cpp b/Swiften/Network/UnboundDomainNameResolver.cpp
index 1df6b8f..21bc697 100644
--- a/Swiften/Network/UnboundDomainNameResolver.cpp
+++ b/Swiften/Network/UnboundDomainNameResolver.cpp
@@ -61,22 +61,22 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
UnboundWrapperHelper* helper = new UnboundWrapperHelper(resolver, shared_from_this());
retval = ub_resolve_async(ubContext, const_cast<char*>(name.c_str()), LDNS_RR_TYPE_SRV,
1 /* CLASS IN (internet) */,
helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL);
if(retval != 0) {
- SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval) << std::endl;
+ SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval);
delete helper;
}
}
void handleResult(int err, struct ub_result* result) {
std::vector<DomainNameServiceQuery::Result> serviceRecords;
if(err != 0) {
- SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err) << std::endl;
+ SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err);
} else {
if(result->havedata) {
ldns_pkt* replyPacket = 0;
ldns_buffer* buffer = ldns_buffer_new(1024);
if (buffer && ldns_wire2pkt(&replyPacket, static_cast<const uint8_t*>(result->answer_packet), result->answer_len) == LDNS_STATUS_OK) {
ldns_rr_list* rrList = ldns_pkt_answer(replyPacket);
@@ -102,13 +102,13 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
}
char terminator = 0;
ldns_buffer_write(buffer, &terminator, sizeof(terminator));
serviceRecord.hostname = std::string(reinterpret_cast<char*>(ldns_buffer_at(buffer, 0)));
serviceRecords.push_back(serviceRecord);
- SWIFT_LOG(debug) << "hostname " << serviceRecord.hostname << " added" << std::endl;
+ SWIFT_LOG(debug) << "hostname " << serviceRecord.hostname << " added";
}
}
if (replyPacket) ldns_pkt_free(replyPacket);
if (buffer) ldns_buffer_free(buffer);
}
}
@@ -134,38 +134,38 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
//FIXME: support AAAA queries in some way
retval = ub_resolve_async(ubContext, const_cast<char*>(name.c_str()), LDNS_RR_TYPE_A,
1 /* CLASS IN (internet) */,
helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL);
if(retval != 0) {
- SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval) << std::endl;
+ SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval);
delete helper;
}
}
void handleResult(int err, struct ub_result* result) {
std::vector<HostAddress> addresses;
boost::optional<DomainNameResolveError> error;
- SWIFT_LOG(debug) << "Result for: " << name << std::endl;
+ SWIFT_LOG(debug) << "Result for: " << name;
if(err != 0) {
- SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err) << std::endl;
+ SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err);
error = DomainNameResolveError();
} else {
if(result->havedata) {
for(int i=0; result->data[i]; i++) {
char address[100];
const char* addressStr = 0;
if ((addressStr = inet_ntop(AF_INET, result->data[i], address, 100))) {
- SWIFT_LOG(debug) << "IPv4 address: " << addressStr << std::endl;
+ SWIFT_LOG(debug) << "IPv4 address: " << addressStr;
addresses.push_back(HostAddress(std::string(addressStr)));
} else if ((addressStr = inet_ntop(AF_INET6, result->data[i], address, 100))) {
- SWIFT_LOG(debug) << "IPv6 address: " << addressStr << std::endl;
+ SWIFT_LOG(debug) << "IPv6 address: " << addressStr;
addresses.push_back(HostAddress(std::string(addressStr)));
} else {
- SWIFT_LOG(debug) << "inet_ntop() failed" << std::endl;
+ SWIFT_LOG(debug) << "inet_ntop() failed";
error = DomainNameResolveError();
}
}
} else {
error = DomainNameResolveError();
}
@@ -179,27 +179,27 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
std::string name;
};
UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) {
ubContext = ub_ctx_create();
if(!ubContext) {
- SWIFT_LOG(debug) << "could not create unbound context" << std::endl;
+ SWIFT_LOG(debug) << "could not create unbound context";
}
eventOwner = std::make_shared<EventOwner>();
ub_ctx_async(ubContext, true);
int ret;
/* read /etc/resolv.conf for DNS proxy settings (from DHCP) */
if( (ret=ub_ctx_resolvconf(ubContext, const_cast<char*>("/etc/resolv.conf"))) != 0) {
- SWIFT_LOG(error) << "error reading resolv.conf: " << ub_strerror(ret) << ". errno says: " << strerror(errno) << std::endl;
+ SWIFT_LOG(error) << "error reading resolv.conf: " << ub_strerror(ret) << ". errno says: " << strerror(errno);
}
/* read /etc/hosts for locally supplied host addresses */
if( (ret=ub_ctx_hosts(ubContext, const_cast<char*>("/etc/hosts"))) != 0) {
- SWIFT_LOG(error) << "error reading hosts: " << ub_strerror(ret) << ". errno says: " << strerror(errno) << std::endl;
+ SWIFT_LOG(error) << "error reading hosts: " << ub_strerror(ret) << ". errno says: " << strerror(errno);
}
ubDescriptior.assign(ub_fd(ubContext));
ubDescriptior.async_read_some(boost::asio::null_buffers(), boost::bind(&UnboundDomainNameResolver::handleUBSocketReadable, this, boost::asio::placeholders::error));
}
@@ -228,13 +228,13 @@ void UnboundDomainNameResolver::handleUBSocketReadable(boost::system::error_code
}
void UnboundDomainNameResolver::processData() {
if (ub_poll(ubContext)) {
int ret = ub_process(ubContext);
if(ret != 0) {
- SWIFT_LOG(debug) << "resolve error: " << ub_strerror(ret) << std::endl;
+ SWIFT_LOG(debug) << "resolve error: " << ub_strerror(ret);
}
}
}
std::shared_ptr<DomainNameServiceQuery> UnboundDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) {
boost::optional<std::string> encodedDomain = idnConverter->getIDNAEncoded(domain);