MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / watchKeepAlive

Method watchKeepAlive

internal/api/server.go:951–979  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

949}
950
951func (s *Server) watchKeepAlive() {
952 if !s.keepAliveEnabled {
953 return
954 }
955
956 timer := time.NewTimer(s.keepAliveTimeout)
957 defer timer.Stop()
958
959 for {
960 select {
961 case <-timer.C:
962 log.Warnf("keep-alive endpoint idle for %s, shutting down", s.keepAliveTimeout)
963 if s.keepAliveOnTimeout != nil {
964 s.keepAliveOnTimeout()
965 }
966 return
967 case <-s.keepAliveHeartbeat:
968 if !timer.Stop() {
969 select {
970 case <-timer.C:
971 default:
972 }
973 }
974 timer.Reset(s.keepAliveTimeout)
975 case <-s.keepAliveStop:
976 return
977 }
978 }
979}
980
981// isAnthropicModelsRequest reports whether a /v1/models request should be served in
982// Anthropic format. Anthropic API clients send the Anthropic-Version header; Claude

Callers 1

enableKeepAliveMethod · 0.95

Calls 1

StopMethod · 0.65

Tested by

no test coverage detected