소스 검색

server: set short dial timeout for raft communication

Yicheng Qin 12 년 전
부모
커밋
5283002132
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      etcd/etcd.go

+ 2 - 0
etcd/etcd.go

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