From fbb109201933428f67c4b93bd29fa856522c3cda Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 12 Jun 2020 14:02:33 -0400 Subject: [PATCH] revert changes from earlier change --- helper/pool/pool.go | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/helper/pool/pool.go b/helper/pool/pool.go index a774a2cb26b..bc2d40a214e 100644 --- a/helper/pool/pool.go +++ b/helper/pool/pool.go @@ -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