2018-12-20 21:43:52 +00:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2019-03-01 00:33:44 +00:00
|
|
|
"github.com/hashicorp/go-plugin/internal/proto"
|
2018-12-20 21:43:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// GRPCControllerServer handles shutdown calls to terminate the server when the
|
|
|
|
// plugin client is closed.
|
|
|
|
type grpcControllerServer struct {
|
|
|
|
server *GRPCServer
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown stops the grpc server. It first will attempt a graceful stop, then a
|
|
|
|
// full stop on the server.
|
2019-03-01 00:33:44 +00:00
|
|
|
func (s *grpcControllerServer) Shutdown(ctx context.Context, _ *proto.Empty) (*proto.Empty, error) {
|
|
|
|
resp := &proto.Empty{}
|
2018-12-20 21:43:52 +00:00
|
|
|
|
|
|
|
// TODO: figure out why GracefullStop doesn't work.
|
|
|
|
s.server.Stop()
|
|
|
|
return resp, nil
|
|
|
|
}
|