From 56318f5433867430e3d89601d026f7e97058f1c0 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 16 Feb 2016 19:18:05 -0800 Subject: [PATCH] rafthttp: add necessary locking --- rafthttp/transport.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rafthttp/transport.go b/rafthttp/transport.go index 820f4d1ba..fd8b41528 100644 --- a/rafthttp/transport.go +++ b/rafthttp/transport.go @@ -289,6 +289,8 @@ func (t *Transport) ActiveSince(id types.ID) time.Time { } func (t *Transport) SendSnapshot(m snap.Message) { + t.mu.Lock() + defer t.mu.Unlock() p := t.peers[types.ID(m.To)] if p == nil { m.CloseWithError(errMemberNotFound)