Fix the format issue

This commit is contained in:
Ting Yuan 2021-05-21 21:23:38 +08:00
parent 1b700e5ed8
commit 2d2a95c3fb

View File

@ -26,13 +26,13 @@ type StubServer struct {
s *grpc.Server s *grpc.Server
cleanups []func() // Lambdas executed in Stop(); populated by Start(). cleanups []func() // Lambdas executed in Stop(); populated by Start().
started chan struct{} started chan struct{}
} }
func New(testService testpb.TestServiceServer) *StubServer { func New(testService testpb.TestServiceServer) *StubServer {
return &StubServer{ return &StubServer{
testService: testService, testService: testService,
started: make(chan struct{}), started: make(chan struct{}),
} }
} }
@ -67,6 +67,7 @@ func (ss *StubServer) Start(sopts []grpc.ServerOption, dopts ...grpc.DialOption)
// Stop stops ss and cleans up all resources it consumed. // Stop stops ss and cleans up all resources it consumed.
func (ss *StubServer) Stop() { func (ss *StubServer) Stop() {
<-ss.started <-ss.started
for i := len(ss.cleanups) - 1; i >= 0; i-- { for i := len(ss.cleanups) - 1; i >= 0; i-- {
ss.cleanups[i]() ss.cleanups[i]()
} }