mirror of https://github.com/status-im/consul.git
Cleans up some small things based on review feedback.
This commit is contained in:
parent
7525836b28
commit
fcbb615aa0
|
@ -16,6 +16,8 @@ import (
|
|||
"github.com/hashicorp/yamux"
|
||||
)
|
||||
|
||||
const defaultDialTimeout = 10 * time.Second
|
||||
|
||||
// muxSession is used to provide an interface for a stream multiplexer.
|
||||
type muxSession interface {
|
||||
Open() (net.Conn, error)
|
||||
|
@ -261,7 +263,7 @@ type HalfCloser interface {
|
|||
// given connection timeout.
|
||||
func (p *ConnPool) DialTimeout(dc string, addr string, timeout time.Duration) (net.Conn, HalfCloser, error) {
|
||||
// Try to dial the conn
|
||||
conn, err := net.DialTimeout("tcp", addr, 10*time.Second)
|
||||
conn, err := net.DialTimeout("tcp", addr, defaultDialTimeout)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -297,7 +299,7 @@ func (p *ConnPool) DialTimeout(dc string, addr string, timeout time.Duration) (n
|
|||
// getNewConn is used to return a new connection
|
||||
func (p *ConnPool) getNewConn(dc string, addr string, version int) (*Conn, error) {
|
||||
// Get a new, raw connection.
|
||||
conn, _, err := p.DialTimeout(dc, addr, 10*time.Second)
|
||||
conn, _, err := p.DialTimeout(dc, addr, defaultDialTimeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ func New(logger *log.Logger, shutdownCh chan struct{}, clusterInfo ManagerSerfCl
|
|||
m.connPoolPinger = connPoolPinger // can't pass *consul.ConnPool: import cycle
|
||||
m.rebalanceTimer = time.NewTimer(clientRPCMinReuseDuration)
|
||||
m.shutdownCh = shutdownCh
|
||||
m.offline = 1
|
||||
atomic.StoreInt32(&m.offline, 1)
|
||||
|
||||
l := serverList{}
|
||||
l.servers = make([]*agent.Server, 0)
|
||||
|
|
|
@ -71,7 +71,7 @@ type areaInfo struct {
|
|||
managers map[string]*managerInfo
|
||||
}
|
||||
|
||||
// NewRouter returns a new router with the given configuration. This will also
|
||||
// NewRouter returns a new Router with the given configuration. This will also
|
||||
// spawn a goroutine that cleans up when the given shutdownCh is closed.
|
||||
func NewRouter(logger *log.Logger, shutdownCh chan struct{}, localDatacenter string) *Router {
|
||||
router := &Router{
|
||||
|
|
Loading…
Reference in New Issue