Browse Source

server: set short dial timeout for raft communication

Yicheng Qin 11 years ago
parent
commit
5283002132
1 changed files with 2 additions and 0 deletions
  1. 2 0
      etcd/etcd.go

+ 2 - 0
etcd/etcd.go

@@ -20,6 +20,7 @@ import (
 	"crypto/tls"
 	"crypto/tls"
 	"fmt"
 	"fmt"
 	"log"
 	"log"
+	"net"
 	"net/http"
 	"net/http"
 	"net/url"
 	"net/url"
 	"os"
 	"os"
@@ -74,6 +75,7 @@ func New(c *config.Config) (*Server, error) {
 
 
 	tr := new(http.Transport)
 	tr := new(http.Transport)
 	tr.TLSClientConfig = tc
 	tr.TLSClientConfig = tc
+	tr.Dial = (&net.Dialer{Timeout: 200 * time.Millisecond}).Dial
 	client := &http.Client{Transport: tr}
 	client := &http.Client{Transport: tr}
 
 
 	s := &Server{
 	s := &Server{