etcdserver: pass scheme into send

This commit is contained in:
Brian Waldon 2014-09-23 10:10:08 -07:00
parent fb7968d704
commit e19b0442f8
2 changed files with 4 additions and 4 deletions

View File

@ -91,12 +91,12 @@ func Sender(t *http.Transport, p Peers) func(msgs []raftpb.Message) {
for _, m := range msgs {
// TODO: reuse go routines
// limit the number of outgoing connections for the same receiver
go send(c, p, m)
go send(c, "http", p, m)
}
}
}
func send(c *http.Client, p Peers, m raftpb.Message) {
func send(c *http.Client, scheme string, p Peers, m raftpb.Message) {
// TODO (xiangli): reasonable retry logic
for i := 0; i < 3; i++ {
addr := p.Pick(m.To)
@ -108,7 +108,7 @@ func send(c *http.Client, p Peers, m raftpb.Message) {
return
}
url := fmt.Sprintf("http://%s%s", addr, raftPrefix)
url := fmt.Sprintf("%s://%s%s", scheme, addr, raftPrefix)
// TODO: don't block. we should be able to have 1000s
// of messages out at a time.

View File

@ -215,7 +215,7 @@ func TestSend(t *testing.T) {
ps := Peers{
42: []string{strings.TrimPrefix(ts.URL, "http://")},
}
send(http.DefaultClient, ps, tt.m)
send(http.DefaultClient, "http", ps, tt.m)
if !tt.ok {
if tr != nil {