fixed one concurrency problem in admin.Close() detected when running the
tests 100 times.
This commit is contained in:
parent
db094d2a13
commit
3117fff4ce
2
Makefile
2
Makefile
@ -14,7 +14,7 @@ vet: fmt
|
|||||||
go vet ./...
|
go vet ./...
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
go test -v -count=1 ./...
|
go test -count=1 ./...
|
||||||
|
|
||||||
build: generate vet
|
build: generate vet
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
|
@ -87,6 +87,9 @@ func NewAdmin() *Admin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (admin *Admin) Close() {
|
func (admin *Admin) Close() {
|
||||||
|
admin.mutex.Lock()
|
||||||
|
defer admin.mutex.Unlock()
|
||||||
|
|
||||||
for _, client := range admin.clients {
|
for _, client := range admin.clients {
|
||||||
client.clientConnection.Close()
|
client.clientConnection.Close()
|
||||||
client.agentConnection.Close()
|
client.agentConnection.Close()
|
||||||
|
Loading…
Reference in New Issue
Block a user