mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: pass scheme into send
This commit is contained in:
parent
fb7968d704
commit
e19b0442f8
@ -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.
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user