MCPcopy Create free account
hub / github.com/F-Stack/f-stack / FreeMsgBuf

Method FreeMsgBuf

adapter/micro_thread/mt_mbuf_pool.cpp:110–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void MsgBuffPool::FreeMsgBuf(MtMsgBuf* msg_buf)
111{
112 if (!_hash_map || !msg_buf) {
113 MTLOG_ERROR("MsgBuffPoll not init or input error! hash %p, msg_buf %p", _hash_map, msg_buf);
114 delete msg_buf;
115 return;
116 }
117 msg_buf->Reset();
118
119 MsgBufMap* msg_map = NULL;
120 MsgBufMap msg_key(msg_buf->GetMaxLen());
121 HashKey* hash_item = _hash_map->HashFind(&msg_key);
122 if (hash_item) {
123 msg_map = (MsgBufMap*)hash_item->GetDataPtr();
124 }
125 if (!hash_item || !msg_map) {
126 MTLOG_ERROR("MsgBuffPoll find no queue, maybe error: %d", msg_buf->GetMaxLen());
127 delete msg_buf;
128 return;
129 }
130 msg_map->FreeMsgBuf(msg_buf);
131
132 return;
133}
134
135

Callers 3

InputNotifyMethod · 0.45
~IMtConnectionMethod · 0.45
ResetMethod · 0.45

Calls 4

GetMaxLenMethod · 0.80
HashFindMethod · 0.80
GetDataPtrMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected