Improved abort signal printing and some reformats
This commit is contained in:
@@ -221,10 +221,11 @@ CommandReassembleResult PacketDecoder::try_reassemble_ordered_packet(
|
||||
ReassembledCommand *&assembled_command) {
|
||||
assert(buffer_lock.owns_lock());
|
||||
|
||||
if(!buffer.front_set())
|
||||
if(!buffer.front_set()) {
|
||||
return CommandReassembleResult::NO_COMMANDS_PENDING;
|
||||
}
|
||||
|
||||
uint8_t packet_flags{0};
|
||||
uint8_t packet_flags;
|
||||
|
||||
std::unique_ptr<ReassembledCommand, void(*)(ReassembledCommand*)> rcommand{nullptr, ReassembledCommand::free};
|
||||
|
||||
@@ -234,11 +235,13 @@ CommandReassembleResult PacketDecoder::try_reassemble_ordered_packet(
|
||||
uint16_t sequence_length{1};
|
||||
size_t total_payload_length{first_buffer.payload_length};
|
||||
do {
|
||||
if(sequence_length >= buffer.capacity())
|
||||
if(sequence_length >= buffer.capacity()) {
|
||||
return CommandReassembleResult::SEQUENCE_LENGTH_TOO_LONG;
|
||||
}
|
||||
|
||||
if(!buffer.slot_set(sequence_length))
|
||||
if(!buffer.slot_set(sequence_length)) {
|
||||
return CommandReassembleResult::NO_COMMANDS_PENDING; /* we need more packets */
|
||||
}
|
||||
|
||||
auto& packet = buffer.slot_value(sequence_length++);
|
||||
total_payload_length += packet.payload_length;
|
||||
@@ -293,12 +296,14 @@ CommandReassembleResult PacketDecoder::try_reassemble_ordered_packet(
|
||||
|
||||
auto compressed_command = std::move(rcommand);
|
||||
auto decompressed_size = compression::qlz_decompressed_size(compressed_command->command(), compressed_command->length());
|
||||
if(decompressed_size > 64 * 1024 * 1024)
|
||||
if(decompressed_size > 64 * 1024 * 1024) {
|
||||
return CommandReassembleResult::COMMAND_TOO_LARGE;
|
||||
}
|
||||
|
||||
rcommand.reset(ReassembledCommand::allocate(decompressed_size));
|
||||
if(!compression::qlz_decompress_payload(compressed_command->command(), rcommand->command(), &decompressed_size))
|
||||
if(!compression::qlz_decompress_payload(compressed_command->command(), rcommand->command(), &decompressed_size)) {
|
||||
return CommandReassembleResult::COMMAND_DECOMPRESS_FAILED;
|
||||
}
|
||||
|
||||
rcommand->set_length(decompressed_size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user