fix: replace duplicate packet IDs before sending queue (#646)

This commit is contained in:
Andre K 2023-06-20 08:22:10 -03:00 committed by GitHub
parent 9970ced53b
commit bb3b1eaa85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View file

@ -850,6 +850,13 @@ class MeshService : Service(), Logging {
private fun processQueuedPackets() = serviceScope.handledLaunch {
packetRepository.get().getQueuedPackets()?.forEach { p ->
// check for duplicate packet IDs before sending (so ACK/NAK updates can work)
if (getDataPacketById(p.id)?.time != p.time) {
val newId = generatePacketId()
debug("Replaced duplicate packet ID in queue: ${p.id}, with: $newId")
packetRepository.get().updateMessageId(p, newId)
p.id = newId
}
try {
sendNow(p)
} catch (ex: Exception) {