MCPcopy
hub / github.com/keploy/keploy / isShutdownError

Function isShutdownError

pkg/agent/proxy/proxy.go:3092–3115  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

3090}
3091
3092func isShutdownError(err error) bool {
3093 if errors.Is(err, context.Canceled) {
3094 return true
3095 }
3096 if errors.Is(err, net.ErrClosed) {
3097 return true
3098 }
3099 errStr := err.Error()
3100 if strings.Contains(errStr, "use of closed network connection") {
3101 return true
3102 }
3103 if errors.Is(err, syscall.ECONNRESET) || errors.Is(err, syscall.ECONNABORTED) {
3104 return true
3105 }
3106 if strings.Contains(errStr, "connection reset by peer") {
3107 return true
3108 }
3109 // Windows-specific error patterns for connection close during shutdown
3110 if strings.Contains(errStr, "wsarecv") || strings.Contains(errStr, "wsasend") ||
3111 strings.Contains(errStr, "forcibly closed by the remote host") {
3112 return true
3113 }
3114 return false
3115}

Callers 2

startMethod · 0.85
handleConnectionMethod · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected