revert changes from earlier change

This commit is contained in:
Mahmood Ali
2020-06-12 14:02:33 -04:00
parent 1f6cb154b9
commit fbb1092019

View File

@@ -305,12 +305,8 @@ func (p *ConnPool) acquire(region string, addr net.Addr, version int) (*Conn, er
return nil, fmt.Errorf("rpc error: lead thread didn't get connection")
}
type HalfCloserConn interface {
net.Conn
CloseWrite() error
}
func (p *ConnPool) DialTimeout(region string, addr net.Addr, version int, mode RPCType) (net.Conn, error) {
// getNewConn is used to return a new connection
func (p *ConnPool) getNewConn(region string, addr net.Addr, version int) (*Conn, error) {
// Try to dial the conn
conn, err := net.DialTimeout("tcp", addr.String(), 10*time.Second)
if err != nil {
@@ -341,22 +337,11 @@ func (p *ConnPool) DialTimeout(region string, addr net.Addr, version int, mode R
}
// Write the multiplex byte to set the mode
if _, err := conn.Write([]byte{byte(mode)}); err != nil {
if _, err := conn.Write([]byte{byte(RpcMultiplexV2)}); err != nil {
conn.Close()
return nil, err
}
return conn, nil
}
// getNewConn is used to return a new connection
func (p *ConnPool) getNewConn(region string, addr net.Addr, version int) (*Conn, error) {
conn, err := p.DialTimeout(region, addr, version, RpcMultiplexV2)
if err != nil {
return nil, err
}
// Setup the logger
conf := yamux.DefaultConfig()
conf.LogOutput = nil