MCPcopy
hub / github.com/tailscale/tailscale / addDebugMessage

Method addDebugMessage

tstest/integration/testcontrol/testcontrol.go:304–333  ·  view source on GitHub ↗
(nodeKeyDst key.NodePublic, msg any)

Source from the content-addressed store, hash-verified

302}
303
304func (s *Server) addDebugMessage(nodeKeyDst key.NodePublic, msg any) bool {
305 s.mu.Lock()
306 defer s.mu.Unlock()
307 node := s.nodeLocked(nodeKeyDst)
308 if node == nil {
309 return false
310 }
311 updatesCh := s.updates[node.ID]
312 if updatesCh == nil {
313 // No streaming poll is registered, so there's nobody to deliver
314 // the message to.
315 return false
316 }
317
318 if _, ok := msg.(*tailcfg.MapResponse); ok {
319 if s.suppressAutoMapResponses == nil {
320 s.suppressAutoMapResponses = set.Set[key.NodePublic]{}
321 }
322 s.suppressAutoMapResponses.Add(nodeKeyDst)
323 }
324
325 mak.Set(&s.msgToSend, nodeKeyDst, append(s.msgToSend[nodeKeyDst], msg))
326 // sendUpdate returning false here is fine: the channel is a lossy
327 // wake-up signal whose buffer is single-slot. A full buffer means a
328 // prior wake-up is still pending, and the streaming poll will check
329 // msgToSend when it processes that wake-up. The queue in msgToSend
330 // is the source of truth.
331 sendUpdate(updatesCh, updateDebugInjection)
332 return true
333}
334
335// Mark the Node key of every node as expired
336func (s *Server) SetExpireAllNodes(expired bool) {

Callers 2

AddPingRequestMethod · 0.95
AddRawMapResponseMethod · 0.95

Calls 6

nodeLockedMethod · 0.95
SetFunction · 0.92
sendUpdateFunction · 0.85
LockMethod · 0.65
UnlockMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected