void PublishingService::addSubscriberTransport(
        RcfSession &rcfSession,
        const std::string &publisherName,
        ClientTransportAutoPtrPtr clientTransportAutoPtrPtr)
    {
        PublisherPtr publisherPtr;

        {
            Lock lock(mPublishersMutex);
            if ( mPublishers.find(publisherName) != mPublishers.end() )
            {
                publisherPtr = mPublishers[publisherName].lock();
            }
        }

        if ( publisherPtr )
        {        
            AsioNetworkSession& networkSession = static_cast<AsioNetworkSession&>(rcfSession.getNetworkSession());

            // For now we assume the presence of wire filters indicates a HTTP/HTTPS connection.
            if ( networkSession.mWireFilters.size() > 0 )
            {
                // This doesn't actually close anything, it just takes the session out of the server IO loop.
                rcfSession.setCloseSessionAfterWrite(true);
                (*clientTransportAutoPtrPtr)->setRcfSession(RcfSessionWeakPtr());

                std::size_t wireFilterCount = networkSession.mWireFilters.size();
                RCF_ASSERT(wireFilterCount == 1 || wireFilterCount == 2);
                RCF_UNUSED_VARIABLE(wireFilterCount);

                ConnectedClientTransport& connClientTransport = static_cast<ConnectedClientTransport&>(**clientTransportAutoPtrPtr);
                connClientTransport.setWireFilters(networkSession.mWireFilters);
                networkSession.mWireFilters.clear();
                networkSession.setTransportFilters(std::vector<FilterPtr>());
            }

            MulticastClientTransport &multicastClientTransport = 
                static_cast<MulticastClientTransport &>(
                    publisherPtr->mRcfClientPtr->getClientStub().getTransport());

            multicastClientTransport.addTransport(*clientTransportAutoPtrPtr);
        }
    }
Example #2
0
    int getRuntimeVersionOfThisRemoteCall()
    {
        int runtimeVersion = 0;
        RcfSession * pRcfSession = getTlsRcfSessionPtr();
        ClientStub * pClientStub = getTlsClientStubPtr();
        if (pRcfSession)
        {
            runtimeVersion = pRcfSession->getRuntimeVersion();
        }
        else if (pClientStub)
        {
            runtimeVersion = pClientStub->getRuntimeVersion();
        }
        else
        {
            // This function must be called from within the client-side
            // or server-side portion of a remote call.
            RCF_ASSERT(0);
            runtimeVersion = getDefaultRuntimeVersion();
        }

        return runtimeVersion;
    }
    void PublishingService::addSubscriberTransport(
        RcfSession &session,
        const std::string &publisherName,
        ClientTransportAutoPtrPtr clientTransportAutoPtrPtr)
    {
        session.setPingTimestamp();

        Lock lock(mPublishersMutex);
        if (mPublishers.find(publisherName) != mPublishers.end())
        {
            PublisherPtr publisherPtr = mPublishers[ publisherName ].lock();
            if (publisherPtr)
            {
                ClientTransport &clientTransport =
                    publisherPtr->mRcfClientPtr->getClientStub().getTransport();

                MulticastClientTransport &multiCastClientTransport =
                    dynamic_cast<MulticastClientTransport &>(clientTransport);

                multiCastClientTransport.addTransport(*clientTransportAutoPtrPtr);
            }
        }
    }
Example #4
0
 void FilterService::setTransportFilters(
     RcfSession &session,
     boost::shared_ptr<std::vector<FilterPtr> > filters)
 {
     session.getSessionState().setTransportFilters(*filters);
 }