Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Commit

Permalink
Merge pull request #217 from xiangli-cmu/fix_data_race
Browse files Browse the repository at this point in the history
fix(server.go) fix data race between func LogEntries and func appendEntry
  • Loading branch information
xiang90 committed Apr 10, 2014
2 parents 3b1dea1 + bf84fb1 commit 047192e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server.go
Expand Up @@ -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
}

Expand Down

0 comments on commit 047192e

Please sign in to comment.