Remove unnecessary server locks.
parent
46fb02f191
commit
0bd3c9b1cd
|
@ -167,22 +167,16 @@ func (s *Server) LogPath() string {
|
||||||
|
|
||||||
// Retrieves the current state of the server.
|
// Retrieves the current state of the server.
|
||||||
func (s *Server) State() string {
|
func (s *Server) State() string {
|
||||||
// s.mutex.Lock()
|
|
||||||
// defer s.mutex.Unlock()
|
|
||||||
return s.state
|
return s.state
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieves the current term of the server.
|
// Retrieves the current term of the server.
|
||||||
func (s *Server) Term() uint64 {
|
func (s *Server) Term() uint64 {
|
||||||
s.mutex.Lock()
|
|
||||||
defer s.mutex.Unlock()
|
|
||||||
return s.currentTerm
|
return s.currentTerm
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieves the name of the candidate this server voted for in this term.
|
// Retrieves the name of the candidate this server voted for in this term.
|
||||||
func (s *Server) VotedFor() string {
|
func (s *Server) VotedFor() string {
|
||||||
s.mutex.Lock()
|
|
||||||
defer s.mutex.Unlock()
|
|
||||||
return s.votedFor
|
return s.votedFor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue