mapper: preserve node pings when a full update is queued

Updates #3523

(cherry picked from commit 17cb110892)
(cherry picked from commit 7c2260c602)
(cherry picked from commit 6875c4bc8, test only)
This commit is contained in:
Kristoffer Dalby committed 2026-10-13 14:35:52 +02:00
1 parent 6ed6dd8db5
commit a4f854f721
7 files changed
+389 -5

No files matched your search

+9
View File
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"reflect"
"slices"
"strconv"
"sync"
"sync/atomic"
@@ -291,6 +292,14 @@ func (mc *multiChannelNodeConn) prependPending(changes ...change.Change) {
mc.pendingMu.Unlock()
}
// collapsePendingToFull replaces pending, together with incoming, by a
// single full update and the pings it cannot carry ([change.CollapseToFull]).
func (mc *multiChannelNodeConn) collapsePendingToFull(incoming []change.Change) {
mc.pendingMu.Lock()
mc.pending = change.CollapseToFull(mc.id, slices.Concat(mc.pending, incoming))
mc.pendingMu.Unlock()
}
// drainPending atomically removes and returns all pending changes.
// Returns nil if there are no pending changes.
func (mc *multiChannelNodeConn) drainPending() []change.Change {