connection: ensure that tx_request is set on the last packet in a burst
This commit is contained in:
parent
04399c0022
commit
dcd0b1a4a1
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue