diff options
author | randomdan <randomdan@localhost> | 2013-12-01 15:09:05 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-12-01 15:09:05 +0000 |
commit | 97c9eddb4d42332eb52556c617ad317d8749169e (patch) | |
tree | 5fa78fceba42daaeb5442b5fb2dd10d8692c8f07 | |
parent | Bit of refactor and tidy up (diff) | |
download | p2pvr-97c9eddb4d42332eb52556c617ad317d8749169e.tar.bz2 p2pvr-97c9eddb4d42332eb52556c617ad317d8749169e.tar.xz p2pvr-97c9eddb4d42332eb52556c617ad317d8749169e.zip |
Remove tuner from adapter only when there are no more users
-rw-r--r-- | p2pvr/lib/localDevices.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/p2pvr/lib/localDevices.cpp b/p2pvr/lib/localDevices.cpp index 330271a..5478301 100644 --- a/p2pvr/lib/localDevices.cpp +++ b/p2pvr/lib/localDevices.cpp @@ -105,10 +105,6 @@ LocalDevices::ReleaseTuner(const P2PVR::TunerPrx & tuner, const Ice::Current & i auto openTuner = std::find_if(devices.begin(), devices.end(), [tuner](const Devices::value_type & ot) { return ot.second && ot.second->tuner == tuner; }); - auto id = tuner->ice_getIdentity(); - if (ice.adapter->find(id)) { - ice.adapter->remove(id); - } if (openTuner == devices.end()) { Logger()->messagebf(LOG_DEBUG, "%s: Not one of mine", __PRETTY_FUNCTION__); return; @@ -116,6 +112,10 @@ LocalDevices::ReleaseTuner(const P2PVR::TunerPrx & tuner, const Ice::Current & i Logger()->messagebf(LOG_DEBUG, "%s: Locally owned deivce %s", __PRETTY_FUNCTION__, openTuner->first); openTuner->second->clients -= 1; if (openTuner->second->clients == 0) { + auto id = tuner->ice_getIdentity(); + if (ice.adapter->find(id)) { + ice.adapter->remove(id); + } openTuner->second.reset(); } } |