diff options
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/mds-message.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libmdsserver/mds-message.c b/src/libmdsserver/mds-message.c index a999c2a..99554cb 100644 --- a/src/libmdsserver/mds-message.c +++ b/src/libmdsserver/mds-message.c @@ -307,7 +307,7 @@ size_t mds_message_marshal_size(mds_message_t* this, int include_buffer) rc += strlen(this->headers[i]); rc *= sizeof(char); rc += (include_buffer ? 4 : 2) * sizeof(size_t); - rc += (include_buffer ? 1 : 0) * sizeof(int); + rc += (include_buffer ? 2 : 1) * sizeof(int); return rc; } @@ -325,6 +325,9 @@ void mds_message_marshal(mds_message_t* this, char* data, int include_buffer) { size_t i, n; + ((int*)data)[0] = MDS_MESSAGE_T_VERSION; + data += sizeof(int) / sizeof(char); + ((size_t*)data)[0] = this->header_count; ((size_t*)data)[1] = this->payload_size; if (include_buffer) @@ -369,6 +372,9 @@ int mds_message_unmarshal(mds_message_t* this, char* data) { size_t i, n, header_count; + /* ((int*)data)[0] == MDS_MESSAGE_T_VERSION */ + data += sizeof(int) / sizeof(char); + header_count = ((size_t*)data)[0]; this->header_count = 0; this->payload_size = ((size_t*)data)[1]; |