Пример #1
0
    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;
    }
Пример #2
0
    void Subscription::onDisconnect(SubscriptionWeakPtr subWeakPtr, RcfSession & session)
    {
        SubscriptionPtr subPtr = subWeakPtr.lock();
        if (subPtr)
        {
            OnSubscriptionDisconnect f = subPtr->mOnDisconnect;

            subPtr->close();

            if (f)
            {
                f(session);
            }
        }
    }