You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-grpc_basic/router/router.go

22 lines
346 B
Go

package router
import (
"net"
"net/http"
"github.com/soheilhy/cmux"
)
func IgnoreErr(err error) bool {
switch {
case err == nil || err == http.ErrServerClosed || err == cmux.ErrListenerClosed:
return true
}
if opErr, ok := err.(*net.OpError); ok {
return opErr.Err.Error() == "use of closed network connection"
}
return false
}