Skip to content

Commit

Permalink
embed: stop *grpc.Server on *serveCtx serve error
Browse files Browse the repository at this point in the history
If serve errors before *grpc.Server is sent to serversC,
it should be closed manually.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Dec 8, 2017
1 parent e3da56a commit f3fe71d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions embed/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (sctx *serveCtx) serve(
opts := []grpc.DialOption{grpc.WithInsecure()}
gwmux, err := sctx.registerGateway(opts)
if err != nil {
gs.Stop()
return err
}

Expand Down Expand Up @@ -137,11 +138,13 @@ func (sctx *serveCtx) serve(
opts := []grpc.DialOption{grpc.WithTransportCredentials(creds)}
gwmux, err := sctx.registerGateway(opts)
if err != nil {
gs.Stop()
return err
}

tlsl, lerr := transport.NewTLSListener(m.Match(cmux.Any()), tlsinfo)
if lerr != nil {
gs.Stop()
return lerr
}
// TODO: add debug flag; enable logging when debug flag is set
Expand Down

0 comments on commit f3fe71d

Please sign in to comment.