Skip to content
Snippets Groups Projects
Commit 69f44ebd authored by Recolic Keghart's avatar Recolic Keghart
Browse files

.

parent 649bd95f
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ namespace rlib { ...@@ -19,7 +19,7 @@ namespace rlib {
node *prev; node *prev;
node *next; node *next;
extra_info_t extra_info; // bool flag. specially designed for object_pool. extra_info_t extra_info; // bool flag. specially designed for object_pool.
uint32_t magic = 0x19980427; uint32_t magic = 0x19990823;
template <typename... TConstructArgs> template <typename... TConstructArgs>
node(node *prev, node *next, const extra_info_t &extra_info, TConstructArgs... args) node(node *prev, node *next, const extra_info_t &extra_info, TConstructArgs... args)
: data(std::forward<TConstructArgs>(args) ...), prev(prev), next(next), extra_info(extra_info) : data(std::forward<TConstructArgs>(args) ...), prev(prev), next(next), extra_info(extra_info)
...@@ -36,7 +36,7 @@ namespace rlib { ...@@ -36,7 +36,7 @@ namespace rlib {
explicit iterator(node *ptr) : ptr(ptr) {} explicit iterator(node *ptr) : ptr(ptr) {}
explicit iterator(T *data_pointer) : ptr(reinterpret_cast<node *>(data_pointer)) { explicit iterator(T *data_pointer) : ptr(reinterpret_cast<node *>(data_pointer)) {
if (ptr->magic != 0x19980427) if (ptr->magic != 0x19990823)
throw std::invalid_argument( throw std::invalid_argument(
"magic_num verification failed. invalid data_pointer passed or ruined memory?"); "magic_num verification failed. invalid data_pointer passed or ruined memory?");
} }
......
...@@ -631,7 +631,7 @@ namespace rlib { ...@@ -631,7 +631,7 @@ namespace rlib {
private: private:
#pragma pack(push, 1) #pragma pack(push, 1)
struct packed_msg_head { struct packed_msg_head {
uint32_t magic = 0x19980427; uint32_t magic = 0x19990823;
uint64_t len; uint64_t len;
}; };
#pragma pack(pop) #pragma pack(pop)
...@@ -640,7 +640,7 @@ namespace rlib { ...@@ -640,7 +640,7 @@ namespace rlib {
static std::string recv_msg(sockfd_t fd) { static std::string recv_msg(sockfd_t fd) {
packed_msg_head head; packed_msg_head head;
recvn_ex(fd, &head, sizeof(head), MSG_NOSIGNAL); recvn_ex(fd, &head, sizeof(head), MSG_NOSIGNAL);
if(head.magic != 0x19980427) if(head.magic != 0x19990823)
throw std::runtime_error("Invalid magic received."); throw std::runtime_error("Invalid magic received.");
if(head.len > 1024ull*1024*1024*2) if(head.len > 1024ull*1024*1024*2)
throw std::runtime_error("Message len is greater than 2GiB. Refuse to alloc space."); throw std::runtime_error("Message len is greater than 2GiB. Refuse to alloc space.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment