void SubscriptionService::onServerStop(RcfServer &server) { RCF_UNUSED_VARIABLE(server); mPeriodicTimer.stop(); Subscriptions subs; { Lock writeLock(mSubscriptionsMutex); subs = mSubscriptions; } for (Subscriptions::iterator iter = subs.begin(); iter != subs.end(); ++iter) { SubscriptionPtr subscriptionPtr = iter->lock(); if (subscriptionPtr) { subscriptionPtr->close(); } } { Lock writeLock(mSubscriptionsMutex); RCF_ASSERT(mSubscriptions.empty()); } mSubscriptions.clear(); subs.clear(); mpServer = NULL; }
void Subscription::onDisconnect(SubscriptionWeakPtr subWeakPtr, RcfSession & session) { SubscriptionPtr subPtr = subWeakPtr.lock(); if (subPtr) { OnSubscriptionDisconnect f = subPtr->mOnDisconnect; subPtr->close(); if (f) { f(session); } } }