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