Improve ACK logic

This commit is contained in:
Leon Böttger authored and Leon Böttger committed 2026-03-08 14:40:16 +01:00
1 parent c10facbedd
commit e1924e1919
1 file changed
+9 -1
@@ -442,7 +442,15 @@ class NearbyConnection {
}
}
else if offlineFrame.hasV1, offlineFrame.v1.hasType, case .keepAlive = offlineFrame.v1.type {
sendKeepAlive(ack: true)
if offlineFrame.v1.hasKeepAlive {
let keepAlive = offlineFrame.v1.keepAlive
if !keepAlive.hasAck || !keepAlive.ack {
sendKeepAlive(ack: true)
}
} else {
// Older peers can omit the keepAlive payload; default to ACK reply.
sendKeepAlive(ack: true)
}
} else {
if offlineFrame.hasV1, offlineFrame.v1.hasType, offlineFrame.v1.type == .bandwidthUpgradeRetry {