summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Mons <edwin.mons@isode.com>2019-11-19 13:36:05 (GMT)
committerEdwin Mons <edwin.mons@isode.com>2019-11-19 13:58:45 (GMT)
commit261ba8d8595ed8cb90f9c4feb1d6ef642942bcba (patch)
treec7e60d473509db8c4dbff5aa83fbde963d8dd75e /Swiften/Network/UnboundDomainNameResolver.cpp
parent697ae6ae84512a744958b24118197ec7bfdbc1f0 (diff)
downloadswift-261ba8d8595ed8cb90f9c4feb1d6ef642942bcba.zip
swift-261ba8d8595ed8cb90f9c4feb1d6ef642942bcba.tar.bz2
Remove std::endl from SWIFT_LOG calls
The std::endl is now added by ~Log, but only for output to stderr or a log file. Calls to the Android logging system or manually set callbacks will not include the newline in the logging output. JIRA: SWIFT-430 Test-Information: Unit tests pass on Debian 9 Checked that running Swift with logging to stderr still had a newline. Change-Id: I096fdba78a3b8f87db2097951c28c528592183e8
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
@@ -64,7 +64,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
64 1 /* CLASS IN (internet) */, 64 1 /* CLASS IN (internet) */,
65 helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL); 65 helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL);
66 if(retval != 0) { 66 if(retval != 0) {
67 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval) << std::endl; 67 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval);
68 delete helper; 68 delete helper;
69 } 69 }
70 } 70 }
@@ -73,7 +73,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
73 std::vector<DomainNameServiceQuery::Result> serviceRecords; 73 std::vector<DomainNameServiceQuery::Result> serviceRecords;
74 74
75 if(err != 0) { 75 if(err != 0) {
76 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err) << std::endl; 76 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err);
77 } else { 77 } else {
78 if(result->havedata) { 78 if(result->havedata) {
79 ldns_pkt* replyPacket = 0; 79 ldns_pkt* replyPacket = 0;
@@ -105,7 +105,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
105 105
106 serviceRecord.hostname = std::string(reinterpret_cast<char*>(ldns_buffer_at(buffer, 0))); 106 serviceRecord.hostname = std::string(reinterpret_cast<char*>(ldns_buffer_at(buffer, 0)));
107 serviceRecords.push_back(serviceRecord); 107 serviceRecords.push_back(serviceRecord);
108 SWIFT_LOG(debug) << "hostname " << serviceRecord.hostname << " added" << std::endl; 108 SWIFT_LOG(debug) << "hostname " << serviceRecord.hostname << " added";
109 } 109 }
110 } 110 }
111 if (replyPacket) ldns_pkt_free(replyPacket); 111 if (replyPacket) ldns_pkt_free(replyPacket);
@@ -137,7 +137,7 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
137 1 /* CLASS IN (internet) */, 137 1 /* CLASS IN (internet) */,
138 helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL); 138 helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL);
139 if(retval != 0) { 139 if(retval != 0) {
140 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval) << std::endl; 140 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval);
141 delete helper; 141 delete helper;
142 } 142 }
143 } 143 }
@@ -145,10 +145,10 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
145 void handleResult(int err, struct ub_result* result) { 145 void handleResult(int err, struct ub_result* result) {
146 std::vector<HostAddress> addresses; 146 std::vector<HostAddress> addresses;
147 boost::optional<DomainNameResolveError> error; 147 boost::optional<DomainNameResolveError> error;
148 SWIFT_LOG(debug) << "Result for: " << name << std::endl; 148 SWIFT_LOG(debug) << "Result for: " << name;
149 149
150 if(err != 0) { 150 if(err != 0) {
151 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err) << std::endl; 151 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err);
152 error = DomainNameResolveError(); 152 error = DomainNameResolveError();
153 } else { 153 } else {
154 if(result->havedata) { 154 if(result->havedata) {
@@ -156,13 +156,13 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
156 char address[100]; 156 char address[100];
157 const char* addressStr = 0; 157 const char* addressStr = 0;
158 if ((addressStr = inet_ntop(AF_INET, result->data[i], address, 100))) { 158 if ((addressStr = inet_ntop(AF_INET, result->data[i], address, 100))) {
159 SWIFT_LOG(debug) << "IPv4 address: " << addressStr << std::endl; 159 SWIFT_LOG(debug) << "IPv4 address: " << addressStr;
160 addresses.push_back(HostAddress(std::string(addressStr))); 160 addresses.push_back(HostAddress(std::string(addressStr)));
161 } else if ((addressStr = inet_ntop(AF_INET6, result->data[i], address, 100))) { 161 } else if ((addressStr = inet_ntop(AF_INET6, result->data[i], address, 100))) {
162 SWIFT_LOG(debug) << "IPv6 address: " << addressStr << std::endl; 162 SWIFT_LOG(debug) << "IPv6 address: " << addressStr;
163 addresses.push_back(HostAddress(std::string(addressStr))); 163 addresses.push_back(HostAddress(std::string(addressStr)));
164 } else { 164 } else {
165 SWIFT_LOG(debug) << "inet_ntop() failed" << std::endl; 165 SWIFT_LOG(debug) << "inet_ntop() failed";
166 error = DomainNameResolveError(); 166 error = DomainNameResolveError();
167 } 167 }
168 } 168 }
@@ -182,7 +182,7 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
182UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) { 182UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) {
183 ubContext = ub_ctx_create(); 183 ubContext = ub_ctx_create();
184 if(!ubContext) { 184 if(!ubContext) {
185 SWIFT_LOG(debug) << "could not create unbound context" << std::endl; 185 SWIFT_LOG(debug) << "could not create unbound context";
186 } 186 }
187 eventOwner = std::make_shared<EventOwner>(); 187 eventOwner = std::make_shared<EventOwner>();
188 188
@@ -192,11 +192,11 @@ UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter,
192 192
193 /* read /etc/resolv.conf for DNS proxy settings (from DHCP) */ 193 /* read /etc/resolv.conf for DNS proxy settings (from DHCP) */
194 if( (ret=ub_ctx_resolvconf(ubContext, const_cast<char*>("/etc/resolv.conf"))) != 0) { 194 if( (ret=ub_ctx_resolvconf(ubContext, const_cast<char*>("/etc/resolv.conf"))) != 0) {
195 SWIFT_LOG(error) << "error reading resolv.conf: " << ub_strerror(ret) << ". errno says: " << strerror(errno) << std::endl; 195 SWIFT_LOG(error) << "error reading resolv.conf: " << ub_strerror(ret) << ". errno says: " << strerror(errno);
196 } 196 }
197 /* read /etc/hosts for locally supplied host addresses */ 197 /* read /etc/hosts for locally supplied host addresses */
198 if( (ret=ub_ctx_hosts(ubContext, const_cast<char*>("/etc/hosts"))) != 0) { 198 if( (ret=ub_ctx_hosts(ubContext, const_cast<char*>("/etc/hosts"))) != 0) {
199 SWIFT_LOG(error) << "error reading hosts: " << ub_strerror(ret) << ". errno says: " << strerror(errno) << std::endl; 199 SWIFT_LOG(error) << "error reading hosts: " << ub_strerror(ret) << ". errno says: " << strerror(errno);
200 } 200 }
201 201
202 ubDescriptior.assign(ub_fd(ubContext)); 202 ubDescriptior.assign(ub_fd(ubContext));
@@ -231,7 +231,7 @@ void UnboundDomainNameResolver::processData() {
231 if (ub_poll(ubContext)) { 231 if (ub_poll(ubContext)) {
232 int ret = ub_process(ubContext); 232 int ret = ub_process(ubContext);
233 if(ret != 0) { 233 if(ret != 0) {
234 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(ret) << std::endl; 234 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(ret);
235 } 235 }
236 } 236 }
237} 237}