Merge pull request #7041 from m1093782566/raft-safe

raft: make memory storage set method thread safe
This commit is contained in:
Xiang Li
2016-12-20 09:14:27 -08:00
committed by GitHub

View File

@@ -98,6 +98,8 @@ func (ms *MemoryStorage) InitialState() (pb.HardState, pb.ConfState, error) {
// SetHardState saves the current HardState.
func (ms *MemoryStorage) SetHardState(st pb.HardState) error {
ms.Lock()
defer ms.Unlock()
ms.hardState = st
return nil
}