Browse Source

rafthttp: add necessary locking

Xiang Li 9 years ago
parent
commit
56318f5433
1 changed files with 2 additions and 0 deletions
  1. 2 0
      rafthttp/transport.go

+ 2 - 0
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)