浏览代码

rafthttp: add necessary locking

Xiang Li 10 年之前
父节点
当前提交
56318f5433
共有 1 个文件被更改,包括 2 次插入0 次删除
  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)