google-code-export / rcf-cpp

Automatically exported from code.google.com/p/rcf-cpp
1 stars 0 forks source link

Server side asserts when creating many shortlived Windows named pipe connections #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

When creating many short lived named pipe connections to a server, 
assertions start to fail on the server, in several different places.

Original issue reported on code.google.com by jarl.lin...@gmail.com on 6 Mar 2010 at 1:17

GoogleCodeExporter commented 9 years ago

With RCF 1.2 and earlier, RCF servers will reuse named pipe connections. There 
is a 
bug with this functionality - to fix it in RCF 1.2, open the file 
Win32NamedPipeServerTransport.cpp, and at the top, replace the 
Win32NamedPipeSessionState constructor and destructor with the following code:

    Win32NamedPipeSessionState::Win32NamedPipeSessionState(
        Win32NamedPipeServerTransport & transport,
        HANDLE hPipe) :
            IocpSessionState(transport),
            mTransport(transport),
            mhPipe(hPipe)
    {
        mSessionPtr = mTransport.mpSessionManager->createSession();
        mSessionPtr->setProactor(*this);

        mEnableReconnect = false;
    }

    Win32NamedPipeSessionState::~Win32NamedPipeSessionState()
    {
        RCF_DTOR_BEGIN

            mEnableReconnect = false;
            postClose();

            if (mPreState == Accepting)
            {
                {
                    Lock lock(mTransport.mQueuedAcceptsMutex);
                    --mTransport.mQueuedAccepts;
                }
                if (!mTransport.mPipeName.empty() && mTransport.mOpen)
                {
                    mTransport.createSessionState()->accept();
                }
            }

        RCF_DTOR_END
    }

Original comment by jarl.lin...@gmail.com on 6 Mar 2010 at 1:22

GoogleCodeExporter commented 9 years ago

Original comment by jarl.lin...@gmail.com on 6 Mar 2010 at 1:23