Filter lookup replies by service name
This commit is contained in:
parent
8481de43cc
commit
a2330e77c2
1 changed files with 5 additions and 2 deletions
|
@ -603,14 +603,14 @@ namespace {
|
||||||
std::string strip_service_dn(const std::string& service_name, const std::string& service_dn)
|
std::string strip_service_dn(const std::string& service_name, const std::string& service_dn)
|
||||||
{
|
{
|
||||||
if (service_name.size() <= service_dn.size()) {
|
if (service_name.size() <= service_dn.size()) {
|
||||||
return service_name;
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto needle = service_name.rfind(service_dn);
|
auto needle = service_name.rfind(service_dn);
|
||||||
if (needle == service_name.size() - service_dn.size()) {
|
if (needle == service_name.size() - service_dn.size()) {
|
||||||
return service_name.substr(0, needle - 1);
|
return service_name.substr(0, needle - 1);
|
||||||
} else {
|
} else {
|
||||||
return service_name;
|
return std::string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -746,7 +746,10 @@ void LookupSession::handle_receive(const error_code& error, size_t bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& srv = *sdpair.second.srv;
|
const auto& srv = *sdpair.second.srv;
|
||||||
|
|
||||||
auto service_name = strip_service_dn(sdpair.first, socket->get_service_dn());
|
auto service_name = strip_service_dn(sdpair.first, socket->get_service_dn());
|
||||||
|
if (service_name.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
std::string path;
|
std::string path;
|
||||||
std::string version;
|
std::string version;
|
||||||
|
|
Loading…
Reference in a new issue