Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions rpc/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ namespace rpc

void process_field(buffer& x)
{
if (x.size()==0)
if (x.size() == 0)
return;
x._ptr = _iov->extract_front_continuous(x.size());
if (!x._ptr)
Expand All @@ -462,13 +462,9 @@ namespace rpc
"only Messages are permitted");

// deserialize the main body from back
_iov=iov;
auto t = iov -> extract_back<T>();
if (t) {
if (!t->validate_checksum(iov, t, sizeof(*t))) {
failed = true;
return nullptr;
}
_iov = iov;
auto t = iov->extract_back<T>();
if (t && t->validate_checksum(iov, t, sizeof(*t))) {
// deserialize aligned fields, and non-aligned fields, from front
auto aligned = FilterAlignedFields(this, true);
t->process_fields(aligned);
Expand All @@ -477,7 +473,7 @@ namespace rpc
} else {
failed = true;
}
return t;
return failed ? nullptr : t;
}
};

Expand Down
Loading