SessionPtr AsioServerTransport::createServerSession(
    ClientTransportAutoPtr & clientTransportAutoPtr,
    StubEntryPtr stubEntryPtr,
    bool keepClientConnection)
{
    AsioSessionStatePtr sessionStatePtr(createSessionState());
    SessionPtr sessionPtr(sessionStatePtr->getSessionPtr());
    sessionPtr->setIsCallbackSession(true);

    sessionStatePtr->implTransferNativeFrom(*clientTransportAutoPtr);

    if (stubEntryPtr)
    {
        sessionPtr->setDefaultStubEntryPtr(stubEntryPtr);
    }

    clientTransportAutoPtr.reset();
    if (keepClientConnection)
    {
        clientTransportAutoPtr.reset( createClientTransport(sessionPtr).release() );
    }

    sessionStatePtr->mState = AsioSessionState::WritingData;
    sessionStatePtr->onAppReadWriteCompleted(0);
    return sessionPtr;
}
    void MulticastClientTransport::addTransport(
        ClientTransportAutoPtr clientTransportAutoPtr)
    {
        Lock lock(mClientTransportsMutex);

        clientTransportAutoPtr->setAsync(false);

        mAddedClientTransports.push_back( ClientTransportAutoPtrPtr( 
            new ClientTransportAutoPtr(clientTransportAutoPtr) ) );
    }
    SessionPtr 
        InProcessTransport::createServerSession(
            ClientTransportAutoPtr & clientTransportAutoPtr,
            StubEntryPtr stubEntryPtr,
            bool keepClientConnection)
    {
        RCF_UNUSED_VARIABLE(keepClientConnection);

        InProcessTransport * pTransport = dynamic_cast<InProcessTransport *>(
            clientTransportAutoPtr.get());

        if (pTransport->mOppositeSessionPtr && stubEntryPtr)
        {
            pTransport->mOppositeSessionPtr->setDefaultStubEntryPtr(stubEntryPtr);
        }

        return pTransport->mSessionPtr;
    }
Exemplo n.º 4
0
 Subscription::Subscription(
     SubscriptionService & subscriptionService,
     ClientTransportAutoPtr clientTransportAutoPtr,
     RcfSessionWeakPtr rcfSessionWeakPtr,
     boost::uint32_t incomingPingIntervalMs,
     const std::string & publisherUrl,
     const std::string & topic,
     OnSubscriptionDisconnect onDisconnect) :
         mSubscriptionService(subscriptionService),
         mRcfSessionWeakPtr(rcfSessionWeakPtr),
         mConnectionPtr(),
         mPingIntervalMs(incomingPingIntervalMs),
         mPingsEnabled(false),
         mPublisherUrl(publisherUrl),
         mTopic(topic),
         mOnDisconnect(onDisconnect),
         mClosed(false)
 {
     if ( clientTransportAutoPtr.get() )
     {
         mConnectionPtr.reset(new I_RcfClient("", clientTransportAutoPtr));
         mConnectionPtr->getClientStub().setAutoReconnect(false);
     }
 }