refactor(server.go) change server.stopped a chan of chan

It is a clean way to sync between a function call and a goroutine.