Record of NS_Simulator bug fixed.
2012-04-07 22:15
162 查看
In "RunController.h":
/*
Modify in 2012_04_07:
@1: modify the ~RunController(), in which MNs can be destruct without any obstruct, and guide MNs to destroy their pkts in buffer.
*/
In "Node.h":
/*
Modify in 2012_04_07:
@1: modify the Clear_MNs_Pkts(), and add the DestroyPkts() function into it;
@2: modify the ReceiveAndStorePkt( int nPktType, char* pPkt), every MN should keep its own pkts buffer, not the pointer to the source MN's newed pkt.
*/
Display the modified ReceiveAndStorePkt function here:
// ---------------- ReceiveAndStorePkt:
// Create a new Packet depend on the pSrcPkt, and store it into its buffer Storage.
void MNode::ReceiveAndStorePkt( _in int nPktType, _in char* pSrcPkt)
{
assert( NULL != pSrcPkt);
if ( NULL == pSrcPkt)
{
LogFile::instance()->m_ofErrLog << "Error: in MNode::StorePkt, NULL == pSrcPkt.\n";
return;
}
// 1) Copy and Store the received Pkt, !! must create a new pPkt_dataPiece here.
char* pPktData = new char[PIECESIZE+1];
memset( pPktData, 0, PIECESIZE+1 );
memcpy( pPktData, pSrcPkt, PIECESIZE );
this->m_map_PktID__PktType_pData.insert( make_pair(m_nPktID, make_pair( nPktType, pPktData )) );
m_nPktID++; // every time, the PktID++.
// ...
}
// ------------- ReceiveAndStorePkt:~
/*
Modify in 2012_04_07:
@1: modify the ~RunController(), in which MNs can be destruct without any obstruct, and guide MNs to destroy their pkts in buffer.
*/
In "Node.h":
/*
Modify in 2012_04_07:
@1: modify the Clear_MNs_Pkts(), and add the DestroyPkts() function into it;
@2: modify the ReceiveAndStorePkt( int nPktType, char* pPkt), every MN should keep its own pkts buffer, not the pointer to the source MN's newed pkt.
*/
Display the modified ReceiveAndStorePkt function here:
// ---------------- ReceiveAndStorePkt:
// Create a new Packet depend on the pSrcPkt, and store it into its buffer Storage.
void MNode::ReceiveAndStorePkt( _in int nPktType, _in char* pSrcPkt)
{
assert( NULL != pSrcPkt);
if ( NULL == pSrcPkt)
{
LogFile::instance()->m_ofErrLog << "Error: in MNode::StorePkt, NULL == pSrcPkt.\n";
return;
}
// 1) Copy and Store the received Pkt, !! must create a new pPkt_dataPiece here.
char* pPktData = new char[PIECESIZE+1];
memset( pPktData, 0, PIECESIZE+1 );
memcpy( pPktData, pSrcPkt, PIECESIZE );
this->m_map_PktID__PktType_pData.insert( make_pair(m_nPktID, make_pair( nPktType, pPktData )) );
m_nPktID++; // every time, the PktID++.
// ...
}
// ------------- ReceiveAndStorePkt:~
相关文章推荐
- KernelBugFixing - A day in the life of a fixed bug
- 【NDN实验】ndnSIM 2.0: A new version of the NDN simulator for NS-3 全文翻译
- IOS常见bug.001—'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in
- Cool, i have fixed the "Access violation writing to 0x00000008" of BlackBerry Simulator(JDE5.0)
- get last date record of each product
- 【IE6 BUG大全】position:fixed在IE6下的实现
- Fix bug in the notepad tutorial of Android
- csharp: using OleDb Getting the identity of the most recently added record
- [lwn] A nasty file corruption bug - fixed (关于Linus解决的一个set_page_dirty很隐蔽的bug)
- Fixed a BUG of VC++ 6.0
- 【Bug-python】IndexError: list index out of range
- Delphi基础Write写入结构体到文件(使用 file of myrecord就行了,真简单)
- Nodemanager Out of heap memory[fix bug全过程]
- Android之JNI ERROR (app bug): accessed stale global reference 0xb39533f2 (index 19708 in a table of s
- fixed bug
- web移动端Fixed在Input获取焦点时ios下产生的BUG及处理
- [Eclipse笔记]Bug 21493 fixed
- A bug of SmartNavigation?
- To record command of git
- Writeup of love(reverse) in BugKu