MCPcopy
hub / github.com/cloudflare/cloudflared / Current

Method Current

connection/protocol.go:157–173  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155}
156
157func (s *remoteProtocolSelector) Current() Protocol {
158 s.lock.Lock()
159 defer s.lock.Unlock()
160 if time.Now().Before(s.refreshAfter) {
161 return s.current
162 }
163
164 protocol, err := getProtocol(s.protocolPool, s.fetchFunc, s.switchThreshold)
165 if err != nil {
166 s.log.Err(err).Msg("Failed to refresh protocol")
167 return s.current
168 }
169 s.current = protocol
170
171 s.refreshAfter = time.Now().Add(s.ttl)
172 return s.current
173}
174
175func (s *remoteProtocolSelector) Fallback() (Protocol, bool) {
176 s.lock.RLock()

Callers

nothing calls this directly

Calls 3

getProtocolFunction · 0.85
AddMethod · 0.65
ErrMethod · 0.45

Tested by

no test coverage detected