Skip to content

Commit

Permalink
Merge pull request #581 from NordicSemiconductor/bugfix/sar
Browse files Browse the repository at this point in the history
Bug fix: ACK was sending too late
  • Loading branch information
philips77 authored Oct 30, 2023
2 parents 58bcdfc + f3809d6 commit 02471c4
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,21 +694,24 @@ private extension LowerTransportLayer {
sendAck(ack, withTtl: ttl)
}

/// Sends the given ACK on the global background queue.
/// Sends the given ACK.
///
/// - note: The ACK used to be sent on a background queue, however this was causing
/// issues. Effectively, this was delaying sending the ACK and another packet
/// could have been sent before. The ACK would then be dropped due to too low
/// sequence number.
///
/// - parameters:
/// - ack: The Segment Acknowledgment Message to sent.
/// - ttl: Initial Time To Live (TTL) value.
func sendAck(_ ack: SegmentAcknowledgmentMessage, withTtl ttl: UInt8) {
DispatchQueue.global(qos: .background).async { [weak self] in
guard let networkManager = self?.networkManager else { return }
self?.logger?.d(.lowerTransport, "Sending \(ack)")
do {
try networkManager.networkLayer.send(lowerTransportPdu: ack,
ofType: .networkPdu, withTtl: ttl)
} catch {
self?.logger?.w(.lowerTransport, error)
}
guard let networkManager = networkManager else { return }
logger?.d(.lowerTransport, "Sending \(ack)")
do {
try networkManager.networkLayer.send(lowerTransportPdu: ack,
ofType: .networkPdu, withTtl: ttl)
} catch {
logger?.w(.lowerTransport, error)
}
}

Expand Down

0 comments on commit 02471c4

Please sign in to comment.