connection: do not send ACKs for empty packets
This commit is contained in:
parent
dedad8b81f
commit
8c3eca658c
|
@ -115,7 +115,7 @@ result_t connection_handle_packet(connection_ctx_t *ctx, const uint8_t *buf, siz
|
||||||
case L2_MSG_TYPE_EMPTY:
|
case L2_MSG_TYPE_EMPTY:
|
||||||
LOG(LVL_DEBUG, "Empty packet: accepted ACK for %u.", ctx->last_acked_seq);
|
LOG(LVL_DEBUG, "Empty packet: accepted ACK for %u.", ctx->last_acked_seq);
|
||||||
// handle the acknowledgement internally
|
// handle the acknowledgement internally
|
||||||
connection_handle_ack(ctx, header.rx_seq_nr);
|
connection_handle_ack(ctx, header.rx_seq_nr, false);
|
||||||
return OK; // do not ACK and call back
|
return OK; // do not ACK and call back
|
||||||
|
|
||||||
case L2_MSG_TYPE_CONN_MGMT:
|
case L2_MSG_TYPE_CONN_MGMT:
|
||||||
|
@ -142,7 +142,7 @@ result_t connection_handle_packet(connection_ctx_t *ctx, const uint8_t *buf, siz
|
||||||
LOG(LVL_INFO, "Received ACK for seq_nr %u in packet seq_nr %u.", header.rx_seq_nr, header.tx_seq_nr);
|
LOG(LVL_INFO, "Received ACK for seq_nr %u in packet seq_nr %u.", header.rx_seq_nr, header.tx_seq_nr);
|
||||||
|
|
||||||
// handle the acknowledgement internally
|
// handle the acknowledgement internally
|
||||||
connection_handle_ack(ctx, header.rx_seq_nr);
|
connection_handle_ack(ctx, header.rx_seq_nr, true);
|
||||||
|
|
||||||
size_t header_size = layer2_get_encoded_header_size(&header);
|
size_t header_size = layer2_get_encoded_header_size(&header);
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ void connection_tx_clean_empty_packet(connection_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void connection_handle_ack(connection_ctx_t *ctx, uint8_t acked_seq)
|
void connection_handle_ack(connection_ctx_t *ctx, uint8_t acked_seq, bool do_ack)
|
||||||
{
|
{
|
||||||
// check the connection state
|
// check the connection state
|
||||||
switch(ctx->conn_state) {
|
switch(ctx->conn_state) {
|
||||||
|
@ -369,7 +369,7 @@ void connection_handle_ack(connection_ctx_t *ctx, uint8_t acked_seq)
|
||||||
|
|
||||||
LOG(LVL_DEBUG, "handling ack for seq_nr %u, removing %zu packets, %zu packets remaining.", acked_seq, packets_to_remove, packets_available);
|
LOG(LVL_DEBUG, "handling ack for seq_nr %u, removing %zu packets, %zu packets remaining.", acked_seq, packets_to_remove, packets_available);
|
||||||
|
|
||||||
if(packets_available == 0) {
|
if(do_ack && packets_available == 0) {
|
||||||
// no packets left in queue, but an acknowledgement must be
|
// no packets left in queue, but an acknowledgement must be
|
||||||
// transmitted. Add an empty packet to do that.
|
// transmitted. Add an empty packet to do that.
|
||||||
result_t res = connection_add_empty_packet(ctx, false);
|
result_t res = connection_add_empty_packet(ctx, false);
|
||||||
|
|
|
@ -123,7 +123,7 @@ void connection_tx_clean_empty_packet(connection_ctx_t *ctx);
|
||||||
* \param acked_seq The acknowledged (= next expected) sequence number.
|
* \param acked_seq The acknowledged (= next expected) sequence number.
|
||||||
* \param do_ack Whether an empty packet shall be generated if the queue is empty.
|
* \param do_ack Whether an empty packet shall be generated if the queue is empty.
|
||||||
*/
|
*/
|
||||||
void connection_handle_ack(connection_ctx_t *ctx, uint8_t acked_seq);
|
void connection_handle_ack(connection_ctx_t *ctx, uint8_t acked_seq, bool do_ack);
|
||||||
|
|
||||||
/*!\brief Check if there are packets queued for transmission.
|
/*!\brief Check if there are packets queued for transmission.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue