| 108 | } |
| 109 | |
| 110 | void 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 |
no test coverage detected