mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
revert changes from earlier change
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user