server: Startup sequence should be more idempotent. (#2974)

Fixes #2971 - honors ignore-disks option properly.
Fixes #2969 - change the net.Dial to have a timeout of 3secs.
This commit is contained in:
Harshavardhana
2016-10-17 14:31:33 -07:00
committed by GitHub
parent 686a610fc3
commit f8e13fb00e
6 changed files with 88 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ import (
"net/http"
"net/rpc"
"sync"
"time"
)
// RPCClient is a wrapper type for rpc.Client which provides reconnect on first failure.
@@ -78,7 +79,8 @@ func (rpcClient *RPCClient) dialRPCClient() (*rpc.Client, error) {
if rpcClient.secureConn {
conn, err = tls.Dial("tcp", rpcClient.node, &tls.Config{})
} else {
conn, err = net.Dial("tcp", rpcClient.node)
// Have a dial timeout with 3 secs.
conn, err = net.DialTimeout("tcp", rpcClient.node, 3*time.Second)
}
if err != nil {
return nil, err