void CWaveSession::ProcessPostResponse() { ASSERT(m_lpPostRequest != NULL); delete m_lpPostRequest; m_lpPostRequest = NULL; FlushRequestQueue(); }
void CWaveSession::ReleaseRequestFlush() { m_nFlushSuspended--; ASSERT(m_nFlushSuspended >= 0); if (m_nFlushSuspended == 0) { FlushRequestQueue(); } }
bool TSocketConnection::Iteration() { auto& Socket = *mSocket; try { Socket.CreateTcp(true); if ( !Socket.IsConnected() ) { mConnectionRef = Socket.Connect( mServerAddress ); // if blocking and returns invalid, then the socket has probably error'd if ( !mConnectionRef.IsValid() ) { throw Soy::AssertException("Connecton failed"); } FlushRequestQueue(); if ( !mReadThread ) { mReadThread = CreateReadThread( mSocket, mConnectionRef ); } } } catch ( std::exception& e ) { Shutdown(); std::stringstream Error; Error << "Failed to create & connect TCP socket: " << e.what(); auto ErrorStr = Error.str(); mOnError.OnTriggered( ErrorStr ); return true; } // only wake up when something happens now SetWakeMode( SoyWorkerWaitMode::Wake ); return true; }
void TSocketConnection::SendRequest(std::shared_ptr<Soy::TWriteProtocol> Request) { mRequestQueue.PushBack( Request ); FlushRequestQueue(); }
void CWaveSession::ProcessSIDResponse() { ASSERT(m_lpRequest != NULL); CCurlUTF8StringReader * lpReader = (CCurlUTF8StringReader *)m_lpRequest->GetReader(); ASSERT(lpReader != NULL); if (m_lpRequest->GetResult() != CURLE_OK) { m_nLoginError = WLE_NETWORK; } else { SetCookies(m_lpRequest->GetCookies()); wstring szChannelResponse(ExtractChannelResponse(lpReader->GetString())); if ( !szChannelResponse.empty() && ParseChannelResponse(szChannelResponse) ) { m_nLoginError = WLE_SUCCESS; } else { m_nLoginError = WLE_AUTHENTICATE; } } delete lpReader; delete m_lpRequest; m_lpRequest = NULL; m_nRequesting = WSR_NONE; if (m_nLoginError == WLE_SUCCESS) { m_nState = WSS_ONLINE; SignalProgress(WCS_LOGGED_ON); PostChannelRequest(); FlushRequestQueue(); } else { // When we were not able to log retireve the SID session, it could be // that the sticky session ID is not valid anymore. Invalidate. m_szStickySessionID = L""; if (m_nState == WSS_RECONNECTING) { NextReconnect(); } else { m_nState = WSS_OFFLINE; SignalProgress(WCS_FAILED); } } }