From 2292da15d68db9f7654cfd5471e465164e5af94c Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Wed, 31 Dec 2014 10:02:45 -0800 Subject: [PATCH] rafthttp: fix stream.open call --- rafthttp/peer.go | 2 +- rafthttp/streamer.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rafthttp/peer.go b/rafthttp/peer.go index 55b377159..5493371f9 100644 --- a/rafthttp/peer.go +++ b/rafthttp/peer.go @@ -117,7 +117,7 @@ func (p *peer) Send(m raftpb.Message) error { p.mu.Lock() u := p.u p.mu.Unlock() - p.stream.open(p.id, types.ID(m.To), p.cid, m.Term, p.tr, u, p.r) + p.stream.open(types.ID(m.From), p.id, p.cid, m.Term, p.tr, u, p.r) p.batcher.Reset(time.Now()) } diff --git a/rafthttp/streamer.go b/rafthttp/streamer.go index f34dd289c..24866eb95 100644 --- a/rafthttp/streamer.go +++ b/rafthttp/streamer.go @@ -49,12 +49,12 @@ type stream struct { client *streamClient } -func (s *stream) open(id, to, cid types.ID, term uint64, tr http.RoundTripper, u string, r Raft) error { +func (s *stream) open(from, to, cid types.ID, term uint64, tr http.RoundTripper, u string, r Raft) error { if s.client != nil { panic("open: stream is open") } - c, err := newStreamClient(id, to, cid, term, tr, u, r) + c, err := newStreamClient(from, to, cid, term, tr, u, r) if err != nil { log.Printf("stream: error opening stream: %v", err) return err