mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-02 11:44:05 +09:00
mapper: preserve node pings when a full update is queued
Updates #3523 (cherry picked from commit17cb110892) (cherry picked from commit7c2260c602) (cherry picked from commit6875c4bc8, test only)
This commit is contained in:
1 parent
6ed6dd8db5
commit
a4f854f721
7 files changed
+389
-5
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user