mirror of https://github.com/status-im/consul.git
consul: don't close a nil connection
This commit is contained in:
parent
77436a15fd
commit
c8f35aea45
|
@ -4,15 +4,16 @@ import (
|
||||||
"container/list"
|
"container/list"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hashicorp/yamux"
|
|
||||||
"github.com/inconshreveable/muxado"
|
|
||||||
"github.com/ugorji/go/codec"
|
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/rpc"
|
"net/rpc"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/hashicorp/yamux"
|
||||||
|
"github.com/inconshreveable/muxado"
|
||||||
|
"github.com/ugorji/go/codec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// msgpackHandle is a shared handle for encoding/decoding of RPC messages
|
// msgpackHandle is a shared handle for encoding/decoding of RPC messages
|
||||||
|
@ -221,11 +222,12 @@ func (p *ConnPool) getNewConn(addr net.Addr, version int) (*Conn, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap the connection in a TLS client
|
// Wrap the connection in a TLS client
|
||||||
conn, err = wrapTLSClient(conn, p.tlsConfig)
|
tlsConn, err := wrapTLSClient(conn, p.tlsConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
conn = tlsConn
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch the multiplexing based on version
|
// Switch the multiplexing based on version
|
||||||
|
|
Loading…
Reference in New Issue