diff options
Diffstat (limited to 'Swiften/Disco/DiscoServiceWalker.cpp')
| -rw-r--r-- | Swiften/Disco/DiscoServiceWalker.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Swiften/Disco/DiscoServiceWalker.cpp b/Swiften/Disco/DiscoServiceWalker.cpp index a3f95d2..7332e63 100644 --- a/Swiften/Disco/DiscoServiceWalker.cpp +++ b/Swiften/Disco/DiscoServiceWalker.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010-2016 Isode Limited. | 2 | * Copyright (c) 2010-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -17,7 +17,7 @@ DiscoServiceWalker::DiscoServiceWalker(const JID& service, IQRouter* iqRouter, s | |||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | void DiscoServiceWalker::beginWalk() { | 19 | void DiscoServiceWalker::beginWalk() { |
| 20 | SWIFT_LOG(debug) << "Starting walk to " << service_ << std::endl; | 20 | SWIFT_LOG(debug) << "Starting walk to " << service_; |
| 21 | assert(!active_); | 21 | assert(!active_); |
| 22 | assert(servicesBeingSearched_.empty()); | 22 | assert(servicesBeingSearched_.empty()); |
| 23 | active_ = true; | 23 | active_ = true; |
| @@ -26,7 +26,7 @@ void DiscoServiceWalker::beginWalk() { | |||
| 26 | 26 | ||
| 27 | void DiscoServiceWalker::endWalk() { | 27 | void DiscoServiceWalker::endWalk() { |
| 28 | if (active_) { | 28 | if (active_) { |
| 29 | SWIFT_LOG(debug) << "Ending walk to " << service_ << std::endl; | 29 | SWIFT_LOG(debug) << "Ending walk to " << service_; |
| 30 | for (auto&& request : pendingDiscoInfoRequests_) { | 30 | for (auto&& request : pendingDiscoInfoRequests_) { |
| 31 | request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request)); | 31 | request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request)); |
| 32 | } | 32 | } |
| @@ -39,7 +39,7 @@ void DiscoServiceWalker::endWalk() { | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void DiscoServiceWalker::walkNode(const JID& jid) { | 41 | void DiscoServiceWalker::walkNode(const JID& jid) { |
| 42 | SWIFT_LOG(debug) << "Walking node " << jid << std::endl; | 42 | SWIFT_LOG(debug) << "Walking node " << jid; |
| 43 | servicesBeingSearched_.insert(jid); | 43 | servicesBeingSearched_.insert(jid); |
| 44 | searchedServices_.insert(jid); | 44 | searchedServices_.insert(jid); |
| 45 | GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(jid, iqRouter_); | 45 | GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(jid, iqRouter_); |
| @@ -54,7 +54,7 @@ void DiscoServiceWalker::handleDiscoInfoResponse(std::shared_ptr<DiscoInfo> info | |||
| 54 | return; | 54 | return; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | SWIFT_LOG(debug) << "Disco info response from " << request->getReceiver() << std::endl; | 57 | SWIFT_LOG(debug) << "Disco info response from " << request->getReceiver(); |
| 58 | 58 | ||
| 59 | request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request)); | 59 | request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request)); |
| 60 | pendingDiscoInfoRequests_.erase(request); | 60 | pendingDiscoInfoRequests_.erase(request); |
| @@ -90,7 +90,7 @@ void DiscoServiceWalker::handleDiscoItemsResponse(std::shared_ptr<DiscoItems> it | |||
| 90 | return; | 90 | return; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | SWIFT_LOG(debug) << "Received disco items from " << request->getReceiver() << std::endl; | 93 | SWIFT_LOG(debug) << "Received disco items from " << request->getReceiver(); |
| 94 | request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoItemsResponse, this, _1, _2, request)); | 94 | request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoItemsResponse, this, _1, _2, request)); |
| 95 | pendingDiscoItemsRequests_.erase(request); | 95 | pendingDiscoItemsRequests_.erase(request); |
| 96 | if (error) { | 96 | if (error) { |
| @@ -103,7 +103,7 @@ void DiscoServiceWalker::handleDiscoItemsResponse(std::shared_ptr<DiscoItems> it | |||
| 103 | * but I've never seen one in the wild, and it's an easy fix for not looping. | 103 | * but I've never seen one in the wild, and it's an easy fix for not looping. |
| 104 | */ | 104 | */ |
| 105 | if (std::find(searchedServices_.begin(), searchedServices_.end(), item.getJID()) == searchedServices_.end()) { /* Don't recurse infinitely */ | 105 | if (std::find(searchedServices_.begin(), searchedServices_.end(), item.getJID()) == searchedServices_.end()) { /* Don't recurse infinitely */ |
| 106 | SWIFT_LOG(debug) << "Received disco item " << item.getJID() << std::endl; | 106 | SWIFT_LOG(debug) << "Received disco item " << item.getJID(); |
| 107 | walkNode(item.getJID()); | 107 | walkNode(item.getJID()); |
| 108 | } | 108 | } |
| 109 | } | 109 | } |
| @@ -112,12 +112,12 @@ void DiscoServiceWalker::handleDiscoItemsResponse(std::shared_ptr<DiscoItems> it | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | void DiscoServiceWalker::handleDiscoError(const JID& jid, ErrorPayload::ref /*error*/) { | 114 | void DiscoServiceWalker::handleDiscoError(const JID& jid, ErrorPayload::ref /*error*/) { |
| 115 | SWIFT_LOG(debug) << "Disco error from " << jid << std::endl; | 115 | SWIFT_LOG(debug) << "Disco error from " << jid; |
| 116 | markNodeCompleted(jid); | 116 | markNodeCompleted(jid); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | void DiscoServiceWalker::markNodeCompleted(const JID& jid) { | 119 | void DiscoServiceWalker::markNodeCompleted(const JID& jid) { |
| 120 | SWIFT_LOG(debug) << "Node completed " << jid << std::endl; | 120 | SWIFT_LOG(debug) << "Node completed " << jid; |
| 121 | servicesBeingSearched_.erase(jid); | 121 | servicesBeingSearched_.erase(jid); |
| 122 | /* All results are in */ | 122 | /* All results are in */ |
| 123 | if (servicesBeingSearched_.empty()) { | 123 | if (servicesBeingSearched_.empty()) { |
Swift