int _loginServer( const char * host,int port, const char* user, const char *passwd,const char *sessionfile )
{
	if (EPL_LOGIN==getConnectStat(__g_conn)) {
		fprintf(stderr, "already in login\n") ;
		return -1 ;
	}
	
	__g_conn = LoginServer( host,port,user,passwd, sessionfile) ;
	if (__g_conn) {
		init_cmdline_msg(__g_conn) ;
		return  0 ;
	}
	return -1;
//	if (__g_conn) {
//		DestroyConnectorObj(__g_conn) ;
//		__g_conn = 0 ;
//	}
//	__g_conn = LoginServer(  host, port,  user, passwd,sessionfile ) ;
//	if (__g_conn) {
//		init_cmdline_msg(__g_conn) ;
//
//		return 0 ;
//	}
//	return -1;
	
}
Beispiel #2
0
// 检测离线车辆
bool CVechileMgr::CheckOfflineUser( void )
{
	list<_stVechile*> lst ;
	int nsize = GetUser( lst, OFF_LINE ) ;
	if ( nsize == 0 ) {
		return false ;
	}

	time_t now = share::Util::currentTimeUsec() ;

	list<_stVechile*>::iterator it ;

	for ( it = lst.begin(); it != lst.end(); ++ it ) {
		// 简单遍历算法
		_stVechile *temp = *it ;
		if ( now - temp->last_conn_ < MAX_USECOND ){
			continue ;
		}
		temp->last_conn_ = now ;
		// 如果登陆不服务器就直接返回了
		if ( ! LoginServer( temp ) ) {
			return false ;
		}
	}
	return true ;
}
Beispiel #3
0
BOOL KLogClient::Init()
{
    BOOL               bResult          = false;
    BOOL               bRetCode         = false;
    IIniFile*	       piIniFile        = NULL;
    int                nPort            = 0;
    char               szIP[16];

    piIniFile = g_OpenIniFile(GS_SETTINGS_FILENAME);
    KGLOG_PROCESS_ERROR(piIniFile);

    bRetCode = piIniFile->GetString("LogServer", "IP", "127.0.0.1", szIP, sizeof(szIP));
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger("LogServer", "Port", 5005, &nPort);
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger("LogServer", "PingCycle", 30, &m_nPingCycle);
    KGLOG_PROCESS_ERROR(bRetCode);
    KGLOG_PROCESS_ERROR(m_nPingCycle > 0);

    bRetCode = piIniFile->GetString("LogServer", "Identity", "", m_szIdentity, sizeof(m_szIdentity));
    KGLOG_PROCESS_ERROR(bRetCode);
    m_szIdentity[sizeof(m_szIdentity) - 1] = '\0';

    // 无论连上与否,均视为成功
    LoginServer(szIP, nPort, m_szIdentity);

    bResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    return bResult;
}
Beispiel #4
0
BOOL KLogServerAgency::Init()
{
    const KSO3GameCenterSettings& rSettings = g_pSO3GameCenter->m_Settings;

    // 无论连上与否,均视为成功
    LoginServer(rSettings.m_szLogServerIP, rSettings.m_nLogServerPort, rSettings.m_szLogServerIdentity);

    return true;
}
BST_ERR_ENUM_UINT8 BST_APP_CEmailIMAP::HandleImapIDResp( BST_VOID )
{
    BST_ERR_ENUM_UINT8      enErrMsg;
    if ( 0 == BST_OS_MEMCMP( m_pcServerResponse0, "*", 1 ) )
    {
        enErrMsg            = LoginServer();
        if ( BST_NO_ERROR_MSG == enErrMsg )
        {
            m_lServerState  = BST_EMAIL_IMAP_ID;
        }
        return enErrMsg;
    }
    else
    {
        return BST_ERR_UNREACHABLE;
    }
}