Skip to content

Commit

Permalink
revert changes from earlier change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmood Ali committed Jun 12, 2020
1 parent 1f6cb15 commit fbb1092
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions helper/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fbb1092

Please sign in to comment.