summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Mons <edwin.mons@isode.com>2018-11-13 10:54:58 (GMT)
committerEdwin Mons <edwin.mons@isode.com>2018-11-14 13:40:05 (GMT)
commit5d7fc97148125584a44a39a4beee1e71d9518385 (patch)
tree9f630e8a9f69bdbd701c1b3c082bacf2b769938d /Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
parentc0615a472f8d23ce449fd59bbb1cdf7071082a43 (diff)
downloadswift-5d7fc97148125584a44a39a4beee1e71d9518385.zip
swift-5d7fc97148125584a44a39a4beee1e71d9518385.tar.bz2
Address LinkLocal issues
Generation of TXT records might fail if any of the fields is too long, so the result is now an optional (pending Expected). Callsites have been updated to deal with this. Three potentially uncaught exceptions in the Bonjour implementation have been addressed. Test-Information: Unit tests pass on macOS 10.14 and Debian 9 Change-Id: Iec02c4606a18eee855362fd3c3d15614a9e72547
Diffstat (limited to 'Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h')
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
index 7a5555e..4baf87b 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -20,12 +20,17 @@ namespace Swift {
class BonjourResolveServiceQuery : public DNSSDResolveServiceQuery, public BonjourQuery {
public:
BonjourResolveServiceQuery(const DNSSDServiceID& service, std::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) {
- DNSServiceErrorType result = DNSServiceResolve(
- &sdRef, 0, boost::numeric_cast<unsigned int>(service.getNetworkInterfaceID()),
- service.getName().c_str(), service.getType().c_str(),
- service.getDomain().c_str(),
- &BonjourResolveServiceQuery::handleServiceResolvedStatic, this);
- if (result != kDNSServiceErr_NoError) {
+ try {
+ DNSServiceErrorType result = DNSServiceResolve(
+ &sdRef, 0, boost::numeric_cast<unsigned int>(service.getNetworkInterfaceID()),
+ service.getName().c_str(), service.getType().c_str(),
+ service.getDomain().c_str(),
+ &BonjourResolveServiceQuery::handleServiceResolvedStatic, this);
+ if (result != kDNSServiceErr_NoError) {
+ sdRef = nullptr;
+ }
+ }
+ catch (...) {
sdRef = nullptr;
}
}