rafthttp: use 'transport.IsClosedConnError'
@@ -19,7 +19,6 @@ import (
"fmt"
"io"
"io/ioutil"
- "net"
"net/http"
"path"
"strings"
@@ -28,6 +27,7 @@ import (
"github.com/coreos/etcd/etcdserver/stats"
"github.com/coreos/etcd/pkg/httputil"
+ "github.com/coreos/etcd/pkg/transport"
"github.com/coreos/etcd/pkg/types"
"github.com/coreos/etcd/raft/raftpb"
"github.com/coreos/etcd/version"
@@ -317,7 +317,7 @@ func (cr *streamReader) run() {
// all data is read out
case err == io.EOF:
// connection is closed by the remote
- case isClosedConnectionError(err):
+ case transport.IsClosedConnError(err):
default:
cr.status.deactivate(failureType{source: t.String(), action: "read"}, err.Error())
}
@@ -514,11 +514,6 @@ func (cr *streamReader) resume() {
cr.paused = false
}
-func isClosedConnectionError(err error) bool {
- operr, ok := err.(*net.OpError)
- return ok && operr.Err.Error() == "use of closed network connection"
-}
-
// checkStreamSupport checks whether the stream type is supported in the
// given version.
func checkStreamSupport(v *semver.Version, t streamType) bool {
