コード例 #1
0
BOOL CSerialServer::RunDaemon()
{
	WORKSESSION		*pSession;
	char	szBuffer[2048+1];
	int		len;
	long	lCurTime;
	BOOL	bForever = TRUE;

	m_pSaveSession = pSession = NewSession(m_nFD, m_szDevice);
	if (pSession == NULL)
    {
		return FALSE;
    }

	if (!EnterSession(pSession))
	{
		LeaveSession(pSession);
		return FALSE;
	}

	for(;bForever && !m_bExitPending;)
	{
		// Passive mode에서는 수신을 하지 않는다.
		if (m_bPassiveMode)
		{
			USLEEP(1000000);
			continue;
		}

		len	= read(m_nFD, szBuffer, 2048);
		if (len == 0)
		{
			// Timeout Session 
			if (m_nTimeout != -1)
			{
				time(&lCurTime);
				if ((lCurTime-pSession->lLastInput) >= m_nTimeout)
				{
					pSession->lLastInput = lCurTime;
					if (!OnTimeoutSession(pSession))
						break;
				}
			}
			continue;
		}
		else if (len < 0)
		{
			// Terminate Session
			break;
		}
		else
		{
	 		// Receive Session
			time(&pSession->lLastInput);
			AddSessionRecvStream(pSession, szBuffer, len);
		}
	}
	LeaveSession(pSession);
	return FALSE;
}
コード例 #2
0
//-------------------------------------------------------------------------
void CCryLobbySessionHandler::OnGameShutdown()
{
	const CGame::EHostMigrationState  migrationState = (g_pGame ? g_pGame->GetHostMigrationState() : CGame::eHMS_NotMigrating);

	CryLog("CCryLobbySessionHandler::OnGameShutdown(), m_userQuit=%s, migrationState=%d", (m_userQuit ? "true" : "false"), migrationState);








	if(m_userQuit)
	{
		LeaveSession();
	}







}
コード例 #3
0
ファイル: XBVoice.cpp プロジェクト: 3ddy/Jedi-Academy
//-----------------------------------------------------------------------------
// Name: Shutdown()
// Desc: Shutdown the whole voice system
//-----------------------------------------------------------------------------
void CVoiceManager::Shutdown()
{
	// XBL_Cleanup calls this, just in case. But if we're cleanly
	// shutting down from the menu system, we've already killed voice.
	if( !m_bInitialized )
		return;

	// This takes us out of running - and closes down all sockets
	LeaveSession();

	if( FAILED( m_XHVVoiceManager.Shutdown() ) )
		Com_Printf( "ERROR: Couldn't shutdown XHV\n" );

	// Shutdown all mutelist functionality
	if( m_MuteListTask )
	{
		// Pump task to completion
		while( XOnlineTaskContinue( m_MuteListTask ) != XONLINETASK_S_RUNNING_IDLE )
			;

		XOnlineTaskClose( m_MuteListTask );
		m_MuteListTask = NULL;
		m_MuteState = MUTE_IDLE;
	}

	m_bInitialized = false;
}