mirror of
https://github.com/qicosmos/rest_rpc.git
synced 2026-08-29 08:34:47 +08:00
check magic
This commit is contained in:
@@ -155,6 +155,12 @@ private:
|
||||
// const uint32_t body_len = *((int*)(head_));
|
||||
// req_id_ = *((std::uint64_t*)(head_ + sizeof(int32_t)));
|
||||
rpc_header *header = (rpc_header *)(head_);
|
||||
if (header->magic != MAGIC_NUM) {
|
||||
print("protocol error");
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
req_id_ = header->req_id;
|
||||
const uint32_t body_len = header->body_len;
|
||||
req_type_ = header->req_type;
|
||||
|
||||
Reference in New Issue
Block a user