|
@@ -234,10 +234,6 @@ type ConnectTimeoutError struct {
|
|
|
Addr net.Addr
|
|
Addr net.Addr
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type netConnectionTimeoutError interface {
|
|
|
|
|
- Timeout() bool
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func (cte *ConnectTimeoutError) Error() string {
|
|
func (cte *ConnectTimeoutError) Error() string {
|
|
|
return "memcache: connect timeout to " + cte.Addr.String()
|
|
return "memcache: connect timeout to " + cte.Addr.String()
|
|
|
}
|
|
}
|
|
@@ -253,10 +249,8 @@ func (c *Client) dial(addr net.Addr) (net.Conn, error) {
|
|
|
return nc, nil
|
|
return nc, nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if terr, ok := err.(netConnectionTimeoutError); ok {
|
|
|
|
|
- if terr.Timeout() {
|
|
|
|
|
- return nil, &ConnectTimeoutError{addr}
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ne, ok := err.(net.Error); ok && ne.Timeout() {
|
|
|
|
|
+ return nil, &ConnectTimeoutError{addr}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return nil, err
|
|
return nil, err
|