MsgHdr add Destroy

This commit is contained in:
aozhiwei 2020-05-11 13:50:30 +08:00
parent 5a4e95e901
commit 4e1a34704d
2 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,14 @@ namespace f8
return hdr; return hdr;
} }
void MsgHdr::Destroy(MsgHdr* hdr)
{
if (hdr->buf) {
free((void*)hdr->buf);
}
free((void*)hdr);
}
int Net_GetMessageId(::google::protobuf::Message& msg) int Net_GetMessageId(::google::protobuf::Message& msg)
{ {
std::string msgname; std::string msgname;

View File

@ -94,6 +94,7 @@ namespace f8
const void* user_data = nullptr; const void* user_data = nullptr;
MsgHdr* Clone(); MsgHdr* Clone();
static void Destroy(MsgHdr* hdr);
}; };
#ifdef MATCHVS #ifdef MATCHVS