- 论坛徽章:
- 0
|
BOOLEAN CTermInst: oSaveNode(SavedNode *snode, char *key)
{
CSNMap::iterator it = m_snMap.find(key);
if(it != m_snMap.end())
{
LOG_ER(HDBG(), "TERM %s: !!! tid=%s exist, can't saved !!!", m_usrNum.num, key);
return FALSE;
}
printf("--DoSaveNode-- tid=%s\n", key);
m_snMap[key] = snode;
it = m_snMap.find(key);
if(it != m_snMap.end())
{
printf("--find ok-- tid=%s\n", key);
}
m_snMap["123"] = snode;
return TRUE;
}
BOOLEAN CTermInst: reprocessMessage( AppMsgHead* pMsgHd, FSMST* fsmState )
{
BindContext_T *pBindContext = (BindContext_T*)(pMsgHd+1);
STN *pStn = &pMsgHd->stn;
char *pBody = (char *)(pBindContext+1);
int nBody = pMsgHd->fsmHead.nMsgLen - sizeof(AppMsgHead) - sizeof(BindContext_T);
nBody -= 1;
pBody[nBody] = 0;
BOOLEAN ret = TRUE;
pMsgHd->fsmHead.nMsgLen -= 1;
printf("111111111111\n" ;
if(pMsgHd->stn.tsOp == TRANS_CLOSE) // E_ACK
{
printf("1111111111111-----\n" ;
printf("----- tid=%s\n", pStn->TransID.tid);
CSNMap::iterator it=m_snMap.find(pStn->TransID.tid);
if(it != m_snMap.end())
{
printf("2222222222222\n" ;
SavedNode *pSNode = (*it).second;
if(pSNode->rack == RACK_DROP)
ret = FALSE;
DoRemoveNode(pSNode, FALSE);
m_snMap.erase(it);
}
else//*********************
{
CSNMap::iterator it=m_snMap.find("123" ;
if(it != m_snMap.end())
{
printf("fuckkkk key='123' ok size=%d\n", m_snMap.size());
}
printf("fuckkkkkkkkkkkkkkkkkkkkkkkkkk size=%d\n", m_snMap.size());
it=m_snMap.begin();
for(; it!=m_snMap.end(); it++)
{
SavedNode *pSNode = (*it).second;
printf("cccccccc: tid=%s map-tid=%s\n", pStn->TransID.tid, pSNode->sndStn.TransID.tid);
if(strcmp(pStn->TransID.tid, pSNode->sndStn.TransID.tid) == 0 )
{
printf("--- stl tid=%s\n", pStn->TransID.tid);
}
}
}
}
return ret;
}
说明:
先调用DoSaveNode,收到消息后调PreprocessMessage,
症状是DoSaveNode 里设置的 m_snMap[key] = snode,在后面的PreprocessMessage查找不到
map定义:
typedef map<char*, SavedNode*> CSNMap;
CSNMap m_snMap;
如下是运行输出:
--DoSaveNode-- tid=10073982
--find ok-- tid=10073982
19:49:51: <ImApp><4> From IMM (56): getstate$10073982$test_17$USER=test_18$STATE=0$ACK=200$$
19:49:51: <ImApp><4> IM Message: getstate 10073982 test_17 BODY = 'USER=test_18$STATE=0$ACK=200$$'
19:49:51: <ImApp><4> PostPackage: sigCode=1011, len=39
111111111111
1111111111111-----
----- tid=10073982
fuckkkk key='123' ok size=2
fuckkkkkkkkkkkkkkkkkkkkkkkkkk size=2
cccccccc: tid=10073982 map-tid=10073982
caonima stl tid=10073982
cccccccc: tid=10073982 map-tid=10073982
--- stl tid=10073982 |
|