Skip to content

Commit

Permalink
Allow receiving less downlink tx ack items than items in downlink cmd.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Sep 9, 2021
1 parent fbba763 commit 637e396
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/downlink/ack/ack.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,11 @@ func getDownlinkFrame(ctx *ackContext) error {
}

// TODO: remove len(Items) != 0 check at next major release
if len(ctx.DownlinkTXAck.Items) != 0 && len(ctx.DownlinkTXAck.Items) != len(ctx.DownlinkFrame.DownlinkFrame.Items) {
return errors.New("length of ack items is not equal to length of downlink items")
// Validate that we don't receive more ack items than downlink items that were
// sent to the gateway. Receiving less acks is valid, e.g. the gateway might
// ack the first item only.
if len(ctx.DownlinkTXAck.Items) != 0 && len(ctx.DownlinkTXAck.Items) > len(ctx.DownlinkFrame.DownlinkFrame.Items) {
return errors.New("tx ack contains more items than downlink command")
}

// for backwards compatibility
Expand Down

0 comments on commit 637e396

Please sign in to comment.