connection: ensure that tx_request is set on the last packet in a burst
All checks were successful
/ build-hamnet70 (push) Successful in 46s
/ build-doc (push) Successful in 26s
/ deploy-doc (push) Has been skipped

This commit is contained in:
Thomas Kolb 2025-01-01 14:58:31 +01:00
parent 04399c0022
commit dcd0b1a4a1
2 changed files with 7 additions and 2 deletions

View file

@ -490,8 +490,13 @@ size_t connection_encode_next_packet(connection_ctx_t *ctx, uint8_t *buf, size_t
layer2_packet_header_t header = entry->header; layer2_packet_header_t header = entry->header;
header.rx_seq_nr = ctx->next_expected_seq; header.rx_seq_nr = ctx->next_expected_seq;
header.tx_request = (ctx->next_packet_index == (packet_queue_get_used_space(&ctx->packet_queue) - 1));
// encode the header // encode the header
LOG(LVL_DEBUG, "Encoding packet with rx_seq_nr %u, tx_seq_nr %u.", header.rx_seq_nr, header.tx_seq_nr); LOG(LVL_DEBUG, "Encoding packet with rx_seq_nr %u, tx_seq_nr %u, tx_request = (%u == %u -> %d).", header.rx_seq_nr, header.tx_seq_nr,
ctx->next_packet_index,
packet_queue_get_used_space(&ctx->packet_queue) - 1,
header.tx_request);
size_t packet_size = layer2_encode_packet(&header, entry->data, entry->data_len, buf, buf_len); size_t packet_size = layer2_encode_packet(&header, entry->data, entry->data_len, buf, buf_len);
if(packet_size == 0) { if(packet_size == 0) {

View file

@ -233,7 +233,7 @@ int main(void)
if(packet_size == 0) { if(packet_size == 0) {
// no more packets available // no more packets available
LOG(LVL_DEBUG, "Ending burst due to empty packet queue."); LOG(LVL_WARN, "Ending burst without TX Request!");
break; break;
} }