Skip to content
Snippets Groups Projects
Commit 56740314 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

mapping: cleanup

Change-Id: I126589619de15382b7d6ceef7f28aeb404c04633
parent b75ab9d3
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ enum class MappingState { PENDING, IN_PROGRESS, FAILED, OPEN };
enum class NatProtocolType;
class IGD;
class Mapping : std::enable_shared_from_this<Mapping>
class Mapping
{
friend class UPnPContext;
friend class NatPmp;
......@@ -112,7 +112,6 @@ private:
void setIgd(const std::shared_ptr<IGD>& igd);
void setAvailable(bool val);
void setState(const MappingState& state);
void updateState(const MappingState& state, bool notify = true);
void updateDescription();
#if HAVE_LIBNATPMP
void setRenewalTime(sys_clock::time_point time);
......
......@@ -96,20 +96,6 @@ Mapping::setState(const MappingState& state)
state_ = state;
}
void
Mapping::updateState(const MappingState& newState, bool notify)
{
std::unique_lock<std::mutex> lock(mutex_);
if (newState == state_)
return;
state_ = newState;
if (notify && notifyCb_) {
lock.unlock();
notifyCb_(shared_from_this());
}
}
const char*
Mapping::getStateStr() const
{
......
......@@ -847,7 +847,7 @@ UPnPContext::pruneMappingsWithInvalidIgds(const std::shared_ptr<IGD>& igd)
map->toString(),
igd->toString(),
igd->getProtocolName());
map->updateState(MappingState::FAILED);
updateMappingState(map, MappingState::FAILED);
unregisterMapping(map);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment