grpc_controller.go 584 B

1234567891011121314151617181920212223
  1. package plugin
  2. import (
  3. "context"
  4. "github.com/hashicorp/go-plugin/internal/plugin"
  5. )
  6. // GRPCControllerServer handles shutdown calls to terminate the server when the
  7. // plugin client is closed.
  8. type grpcControllerServer struct {
  9. server *GRPCServer
  10. }
  11. // Shutdown stops the grpc server. It first will attempt a graceful stop, then a
  12. // full stop on the server.
  13. func (s *grpcControllerServer) Shutdown(ctx context.Context, _ *plugin.Empty) (*plugin.Empty, error) {
  14. resp := &plugin.Empty{}
  15. // TODO: figure out why GracefullStop doesn't work.
  16. s.server.Stop()
  17. return resp, nil
  18. }