Commit 1dc086e5 authored by Sven Liefgen's avatar Sven Liefgen
Browse files

Update prrt/proto/types/block.c

parent f181efe6
Pipeline #4559 failed with stages
in 12 seconds
......@@ -219,7 +219,7 @@ void PrrtBlock_encode(PrrtBlock *block_ptr, prrtSequenceNumber_t *seqno)
check_mem(src[j]);
PrrtPacket *pkt = cur->value;
pkt->index = (uint8_t) ((pkt->sequenceNumber - baseSequenceNumber) % SEQNO_SPACE);
PrrtPacket_copy_payload_to_buffer(src[j], pkt, 0);
PrrtPacket_encode_payload(src[j], pkt);
j++;
}
......@@ -283,10 +283,14 @@ bool PrrtBlock_decode(PrrtBlock *block_ptr)
for(j = 0; j < k; j++) {
if(idx_p[j] >= k) {
PrrtPacketDataPayload* packet_and_payload = (PrrtPacketDataPayload *) fec[j];
void *payload = calloc(block_ptr->largestPayloadLength, sizeof(uint8_t));
check_mem(payload);
PrrtPacket_decode_payload(fec[j], PACKET_TYPE_DATA, payload, block_ptr->largestPayloadLength);
PrrtPacketDataPayload* packet_and_payload = (PrrtPacketDataPayload *) payload;
PrrtPacket *packet = PrrtPacket_reconstruct_data_packet(packet_and_payload, j,
(prrtSequenceNumber_t) (baseSequenceNumber + j));
free(payload);
debug(DEBUG_BLOCK, "Reconstructed [D]: %d", packet->sequenceNumber);
if(insert_data_packet(block_ptr, packet)) {
debug(DEBUG_BLOCK, "Tried to insert unnecessary packet.");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment