fix(server.go) fix data race in server.stop

Use setState() function to set state; avoid data race.
pull/820/head
Xiang Li 2014-03-24 15:02:15 -04:00
parent aa3d8b7dcb
commit f762c2f448
1 changed files with 1 additions and 1 deletions

View File

@ -503,11 +503,11 @@ func (s *server) Init() error {
func (s *server) Stop() {
stop := make(chan bool)
s.stopped <- stop
s.state = Stopped
// make sure the server has stopped before we close the log
<-stop
s.log.close()
s.setState(Stopped)
}
// Checks if the server is currently running.