Skip to content

Commit

Permalink
teleterm: Close VNet service before stopping gRPC server (#44995)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravicious authored Aug 2, 2024
1 parent 6a52a12 commit be975a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/teleterm/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ func (s *APIServer) Serve() error {

// Stop stops the server and closes all listeners
func (s *APIServer) Stop() {
s.grpcServer.GracefulStop()
// Gracefully stopping the gRPC server takes a second or two. Closing the VNet service is almost
// immediate. Closing the VNet service before the gRPC server gives some time for the VNet admin
// process to notice that the client is gone and shut down as well.
if err := s.vnetService.Close(); err != nil {
log.WithError(err).Error("Error while closing VNet service")
}

s.grpcServer.GracefulStop()
}

func newListener(hostAddr string, listeningC chan<- utils.NetAddr) (net.Listener, error) {
Expand Down

0 comments on commit be975a0

Please sign in to comment.