fix(server): avoid race conditions in Run/Stop

- don't close ready channel until PeerServer is listening.
  avoids possible panic in Stop() if PeerServer is nil.

- avoid data race in Run() (err variable was shared between 2 goroutines)

- avoid data race in PeerServer Start/Stop (PeerServer.closeChan)
This commit is contained in:
Doug MacEachern
2014-04-14 17:03:09 -07:00
parent 66c552d048
commit d73390a674
4 changed files with 60 additions and 4 deletions

View File

@@ -2,6 +2,9 @@
. ./build
go test -i ./etcd
go test -v ./etcd -race
go test -i ./http
go test -v ./http -race