mirror of
https://github.com/juanfont/headscale.git
synced 2025-09-25 17:51:11 +02:00
mapper: only send minimal selfnode outside of full update
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
cbe2e5cdce
commit
57cfc62418
@ -68,24 +68,17 @@ func (b *MapResponseBuilder) WithCapabilityVersion(capVer tailcfg.CapabilityVers
|
|||||||
|
|
||||||
// WithSelfNode adds the requesting node to the response.
|
// WithSelfNode adds the requesting node to the response.
|
||||||
func (b *MapResponseBuilder) WithSelfNode() *MapResponseBuilder {
|
func (b *MapResponseBuilder) WithSelfNode() *MapResponseBuilder {
|
||||||
nodeView, ok := b.mapper.state.GetNodeByID(b.nodeID)
|
nv, ok := b.mapper.state.GetNodeByID(b.nodeID)
|
||||||
if !ok {
|
if !ok {
|
||||||
b.addError(errors.New("node not found"))
|
b.addError(errors.New("node not found"))
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always use batcher's view of online status for self node
|
|
||||||
// The batcher respects grace periods for logout scenarios
|
|
||||||
node := nodeView.AsStruct()
|
|
||||||
// if b.mapper.batcher != nil {
|
|
||||||
// node.IsOnline = ptr.To(b.mapper.batcher.IsConnected(b.nodeID))
|
|
||||||
// }
|
|
||||||
|
|
||||||
_, matchers := b.mapper.state.Filter()
|
_, matchers := b.mapper.state.Filter()
|
||||||
tailnode, err := tailNode(
|
tailnode, err := tailNode(
|
||||||
node.View(), b.capVer, b.mapper.state,
|
nv, b.capVer, b.mapper.state,
|
||||||
func(id types.NodeID) []netip.Prefix {
|
func(id types.NodeID) []netip.Prefix {
|
||||||
return policy.ReduceRoutes(node.View(), b.mapper.state.GetNodePrimaryRoutes(id), matchers)
|
return policy.ReduceRoutes(nv, b.mapper.state.GetNodePrimaryRoutes(id), matchers)
|
||||||
},
|
},
|
||||||
b.mapper.cfg)
|
b.mapper.cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -190,7 +190,6 @@ func (m *mapper) peerChangeResponse(
|
|||||||
return m.NewMapResponseBuilder(nodeID).
|
return m.NewMapResponseBuilder(nodeID).
|
||||||
WithDebugType(changeResponseDebug).
|
WithDebugType(changeResponseDebug).
|
||||||
WithCapabilityVersion(capVer).
|
WithCapabilityVersion(capVer).
|
||||||
WithSelfNode().
|
|
||||||
WithUserProfiles(peers).
|
WithUserProfiles(peers).
|
||||||
WithPeerChanges(peers).
|
WithPeerChanges(peers).
|
||||||
Build()
|
Build()
|
||||||
|
Loading…
Reference in New Issue
Block a user