Beispiel #1
0
bool CDisposeEvent::onSerciveStartUp(void)
{
    try
    {
        CSessionManager::getSingletonPtr()->setLua(m_pLua);
        luabridge::getGlobal(m_pLua, LUA_EVENT_ONSTARTUP)(CSessionManager::getSingletonPtr(), 
            CSessionManager::getSingletonPtr()->getNetBinary(), 
            CSessionManager::getSingletonPtr()->getSerializeBinary(), 
            CEncrypt::getSingletonPtr());
    }
    catch(luabridge::LuaException &e)
    {
        Q_Printf("%s", e.what());
        Q_LOG(LOGLV_ERROR, "%s", e.what());

        return false;
    }
    catch(CQException &e)
    {
        Q_Printf("exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
        Q_LOG(LOGLV_ERROR, "exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());

        return false;
    }

    return true;
}
Beispiel #2
0
void CDisposeEvent::onSerciveShutDown(void)
{
    try
    {
        luabridge::getGlobal(m_pLua, LUA_EVENT_ONSHUTDOWN)();        
    }
    catch(luabridge::LuaException &e)
    {
        Q_Printf("%s", e.what());
        Q_LOG(LOGLV_ERROR, "%s", e.what());
    }
    catch(CQException &e)
    {
        Q_Printf("exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
        Q_LOG(LOGLV_ERROR, "exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
    }
}
Beispiel #3
0
void CDisposeEvent::onLinkedOther(class CSession *pSession)
{
    try
    {
        luabridge::getGlobal(m_pLua, LUA_EVENT_ONLINKEDOTHER)(pSession);
    }
    catch(luabridge::LuaException &e)
    {
        Q_Printf("%s", e.what());
        Q_LOG(LOGLV_ERROR, "%s", e.what());
    }
    catch(CQException &e)
    {
        Q_Printf("exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
        Q_LOG(LOGLV_ERROR, "exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
    }
}
Beispiel #4
0
void CDisposeEvent::onHttpRead(class CHttpParser *pBuffer)
{
    try
    {
        luabridge::getGlobal(m_pLua, LUA_EVENT_ONHTTPREAD)(pBuffer);
    }
    catch(luabridge::LuaException &e)
    {
        Q_Printf("%s", e.what());
        Q_LOG(LOGLV_ERROR, "%s", e.what());
    }
    catch(CQException &e)
    {
        Q_Printf("exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
        Q_LOG(LOGLV_ERROR, "exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
    }
}
Beispiel #5
0
void CDisposeEvent::onDebug(const char *pszMsg, const size_t &iLens)
{
    try
    {
        CSessionManager::getSingletonPtr()->getNetBinary()->setBuffer(pszMsg, iLens);
        luabridge::getGlobal(m_pLua, LUA_EVENT_ONDEBUG)();
    }
    catch(luabridge::LuaException &e)
    {
        Q_Printf("%s", e.what());
        Q_LOG(LOGLV_ERROR, "%s", e.what());
    }
    catch(CQException &e)
    {
        Q_Printf("exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
        Q_LOG(LOGLV_ERROR, "exception. code %d, message %s", 
            e.getErrorCode(), e.getErrorMsg());
    }
}
Beispiel #6
0
void Q_LuaLog(int iLV, const char *pszMsg)
{
    Q_LOG((LOG_LEVEL)iLV, "%s", pszMsg);
}