commit
e2cd96fd87
|
@ -107,14 +107,14 @@ 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()
|
s.mutex.Lock()
|
||||||
s.mutex.Unlock()
|
defer s.mutex.Unlock()
|
||||||
return s.state
|
return s.state
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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()
|
s.mutex.Lock()
|
||||||
s.mutex.Unlock()
|
defer s.mutex.Unlock()
|
||||||
return s.votedFor
|
return s.votedFor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue