Commit 26198fc2 authored by Larry Sachs's avatar Larry Sachs Committed by Rick Bell

Remove 'links' Resources

When a device or service uri is removed, its device or service links
(ie href uris) are also removed.

Change-Id: Ibb7973c6f4e845ea6324dc3af8dd271f584fb4c3
Signed-off-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21427Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
Reviewed-by: default avatarRick Bell <richard.s.bell@intel.com>
parent 20bfdaa6
......@@ -881,16 +881,39 @@ void UpnpConnector::onRemove(std::string uri)
for (const auto& service : s_manager->m_services) {
if (service.second->m_uri == uri) {
if (!service.second->m_links.empty())
{
vector<_link> links = service.second->m_links;
for (unsigned int i = 0; i < links.size(); ++i) {
OCStackResult result = OC::Bridging::ConcurrentIotivityUtils::queueDeleteResource(links[i].href);
DEBUG_PRINT("Service link queueDeleteResource(" << links[i].href << ") result = " << result);
ConcurrentIotivityUtils::queueNotifyObservers(links[i].href);
}
}
OCStackResult result = OC::Bridging::ConcurrentIotivityUtils::queueDeleteResource(uri);
DEBUG_PRINT("queueDeleteResource() result = " << result);
DEBUG_PRINT("Service queueDeleteResource(" << uri << ") result = " << result);
ConcurrentIotivityUtils::queueNotifyObservers(uri);
}
}
for (const auto& device : s_manager->m_devices) {
if (device.second->m_uri == uri) {
if (!device.second->m_links.empty())
{
vector<_link> links = device.second->m_links;
for (unsigned int i = 0; i < links.size(); ++i) {
if (links[i].rt.find(UPNP_DEVICE_RESOURCE) == 0)
{
OCStackResult result = OC::Bridging::ConcurrentIotivityUtils::queueDeleteResource(links[i].href);
DEBUG_PRINT("Device link queueDeleteResource(" << links[i].href << ") result = " << result);
ConcurrentIotivityUtils::queueNotifyObservers(links[i].href);
}
}
}
OCStackResult result = OC::Bridging::ConcurrentIotivityUtils::queueDeleteResource(uri);
DEBUG_PRINT("queueDeleteResource() result = " << result);
DEBUG_PRINT("Device queueDeleteResource(" << uri << ") result = " << result);
ConcurrentIotivityUtils::queueNotifyObservers(uri);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment