MCPcopy Index your code
hub / github.com/tailscale/tailscale / answerHeadPing

Function answerHeadPing

control/controlclient/direct.go:1660–1680  ·  view source on GitHub ↗
(logf logger.Logf, c *http.Client, pr *tailcfg.PingRequest)

Source from the content-addressed store, hash-verified

1658}
1659
1660func answerHeadPing(logf logger.Logf, c *http.Client, pr *tailcfg.PingRequest) {
1661 ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
1662 defer cancel()
1663
1664 req, err := http.NewRequestWithContext(ctx, "HEAD", pr.URL, nil)
1665 if err != nil {
1666 logf("answerHeadPing: NewRequestWithContext: %v", err)
1667 return
1668 }
1669 if pr.Log {
1670 logf("answerHeadPing: sending HEAD ping to %v ...", pr.URL)
1671 }
1672 t0 := clock.Now()
1673 _, err = c.Do(req)
1674 d := clock.Since(t0).Round(time.Millisecond)
1675 if err != nil {
1676 logf("answerHeadPing error: %v to %v (after %v)", err, pr.URL, d)
1677 } else if pr.Log {
1678 logf("answerHeadPing complete to %v (after %v)", pr.URL, d)
1679 }
1680}
1681
1682// sleepAsRequest implements the sleep for a tailcfg.Debug message requesting
1683// that the client sleep. The complication is that while we're sleeping (if for

Callers 1

answerPingMethod · 0.85

Calls 3

NowMethod · 0.65
DoMethod · 0.65
SinceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…