mirror of https://github.com/hashicorp/consul
pool: remove timeout parameter
Timeout was never used in a meaningful way by callers, which is why it is now entirely internal to the pool.pull/7966/head
parent
ad03f863ff
commit
1fbc1d4777
|
@ -200,7 +200,7 @@ func SnapshotRPC(
|
||||||
) (io.ReadCloser, error) {
|
) (io.ReadCloser, error) {
|
||||||
// Write the snapshot RPC byte to set the mode, then perform the
|
// Write the snapshot RPC byte to set the mode, then perform the
|
||||||
// request.
|
// request.
|
||||||
conn, hc, err := connPool.DialTimeout(dc, nodeName, addr, 10*time.Second, pool.RPCSnapshot)
|
conn, hc, err := connPool.DialTimeout(dc, nodeName, addr, pool.RPCSnapshot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,6 @@ func (p *ConnPool) DialTimeout(
|
||||||
dc string,
|
dc string,
|
||||||
nodeName string,
|
nodeName string,
|
||||||
addr net.Addr,
|
addr net.Addr,
|
||||||
timeout time.Duration,
|
|
||||||
actualRPCType RPCType,
|
actualRPCType RPCType,
|
||||||
) (net.Conn, HalfCloser, error) {
|
) (net.Conn, HalfCloser, error) {
|
||||||
p.once.Do(p.init)
|
p.once.Do(p.init)
|
||||||
|
@ -298,7 +297,6 @@ func (p *ConnPool) DialTimeout(
|
||||||
nodeName,
|
nodeName,
|
||||||
addr,
|
addr,
|
||||||
p.SrcAddr,
|
p.SrcAddr,
|
||||||
timeout,
|
|
||||||
p.TLSConfigurator.OutgoingALPNRPCWrapper(),
|
p.TLSConfigurator.OutgoingALPNRPCWrapper(),
|
||||||
actualRPCType,
|
actualRPCType,
|
||||||
RPCTLS,
|
RPCTLS,
|
||||||
|
@ -314,7 +312,6 @@ func (p *ConnPool) DialTimeout(
|
||||||
dc,
|
dc,
|
||||||
nodeName,
|
nodeName,
|
||||||
addr,
|
addr,
|
||||||
timeout,
|
|
||||||
actualRPCType,
|
actualRPCType,
|
||||||
RPCTLS,
|
RPCTLS,
|
||||||
)
|
)
|
||||||
|
@ -324,12 +321,11 @@ func (p *ConnPool) dial(
|
||||||
dc string,
|
dc string,
|
||||||
nodeName string,
|
nodeName string,
|
||||||
addr net.Addr,
|
addr net.Addr,
|
||||||
timeout time.Duration,
|
|
||||||
actualRPCType RPCType,
|
actualRPCType RPCType,
|
||||||
tlsRPCType RPCType,
|
tlsRPCType RPCType,
|
||||||
) (net.Conn, HalfCloser, error) {
|
) (net.Conn, HalfCloser, error) {
|
||||||
// Try to dial the conn
|
// Try to dial the conn
|
||||||
d := &net.Dialer{LocalAddr: p.SrcAddr, Timeout: timeout}
|
d := &net.Dialer{LocalAddr: p.SrcAddr, Timeout: defaultDialTimeout}
|
||||||
conn, err := d.Dial("tcp", addr.String())
|
conn, err := d.Dial("tcp", addr.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -393,7 +389,6 @@ func DialTimeoutWithRPCTypeViaMeshGateway(
|
||||||
nodeName string,
|
nodeName string,
|
||||||
addr net.Addr,
|
addr net.Addr,
|
||||||
src *net.TCPAddr,
|
src *net.TCPAddr,
|
||||||
timeout time.Duration,
|
|
||||||
wrapper tlsutil.ALPNWrapper,
|
wrapper tlsutil.ALPNWrapper,
|
||||||
actualRPCType RPCType,
|
actualRPCType RPCType,
|
||||||
tlsRPCType RPCType,
|
tlsRPCType RPCType,
|
||||||
|
@ -425,7 +420,7 @@ func DialTimeoutWithRPCTypeViaMeshGateway(
|
||||||
return nil, nil, structs.ErrDCNotAvailable
|
return nil, nil, structs.ErrDCNotAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
dialer := &net.Dialer{LocalAddr: src, Timeout: timeout}
|
dialer := &net.Dialer{LocalAddr: src, Timeout: defaultDialTimeout}
|
||||||
|
|
||||||
rawConn, err := dialer.Dial("tcp", gwAddr)
|
rawConn, err := dialer.Dial("tcp", gwAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -461,7 +456,7 @@ func (p *ConnPool) getNewConn(dc string, nodeName string, addr net.Addr) (*Conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a new, raw connection and write the Consul multiplex byte to set the mode
|
// Get a new, raw connection and write the Consul multiplex byte to set the mode
|
||||||
conn, _, err := p.DialTimeout(dc, nodeName, addr, defaultDialTimeout, RPCMultiplexV2)
|
conn, _, err := p.DialTimeout(dc, nodeName, addr, RPCMultiplexV2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -575,7 +570,7 @@ func (p *ConnPool) rpcInsecure(dc string, nodeName string, addr net.Addr, method
|
||||||
}
|
}
|
||||||
|
|
||||||
var codec rpc.ClientCodec
|
var codec rpc.ClientCodec
|
||||||
conn, _, err := p.dial(dc, nodeName, addr, 1*time.Second, 0, RPCTLSInsecure)
|
conn, _, err := p.dial(dc, nodeName, addr, 0, RPCTLSInsecure)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("rpcinsecure error establishing connection: %v", err)
|
return fmt.Errorf("rpcinsecure error establishing connection: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue