Merge pull request #217 from xiangli-cmu/fix_data_race

fix(server.go) fix data race between func LogEntries and func appendEntry
pull/820/head
Xiang Li 2014-04-10 14:35:02 -04:00
commit 047192edb1
1 changed files with 2 additions and 0 deletions

View File

@ -334,6 +334,8 @@ func (s *server) IsLogEmpty() bool {
// A list of all the log entries. This should only be used for debugging purposes.
func (s *server) LogEntries() []*LogEntry {
s.log.mutex.RLock()
defer s.log.mutex.RUnlock()
return s.log.entries
}