示例#1
0
int EventConnection::SendPkg(std::list<IPackage*>& pkgLst)
{
	int ret = YQER_OK;
	for (Iter it = pkgLst.begin(); it != pkgLst.end(); it++){
		int as;
		if ((as=SendPkg(*it)) != YQER_OK){
			ret = as;
		}
	}
	return ret;
}
示例#2
0
/**
 * 消息发送
 */
int TestCase::Write(CMsgBase* pMsg, CLIENT_INFO_T* userClient)
{
    Logger.Log(INFO, "TestCase::Write111 destUserId=%d", pMsg->m_dwId);
    int iRet = IO_SUCCESS;
//    do
//    {
        if (0 == m_stSendBuffer.iSize && 0 == m_stSendBuffer.iTotal)
        {

            int dwSize = MAX_BUFFER_SIZE;
            int iErr = Pack(m_stSendBuffer.cBuffer, dwSize, pMsg);

            if (CMD_USER_HEARTBEAT != pMsg->m_wCmd && CMD_USER_HEARTBEAT_ACK != pMsg->m_wCmd)
            {
                Logger.Log(NOTIC, "<<<<<<  write cmd:[0x%04x] [0x%04x] , to user:%d, err:%d",\
                    (pMsg->m_wCmd), (pMsg->m_wCmd) & ~CMD_INNER_FLAGE, pMsg->m_dwId, iErr);
            }


            if (CMD_USER_HEARTBEAT != pMsg->m_wCmd)
            {
                CMsgBase::DelMsg(pMsg);
            }

//            if (ERR_SUCCESS != iErr)
//            {
//                continue;
//            }

            m_stSendBuffer.iTotal = dwSize;
        }

        iRet = SendPkg(userClient);

//    } while (IO_SUCCESS == iRet);


    return ERR_SUCCESS;
}