2018-12-05 20:27:05 +01:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2019-02-13 00:27:56 +01:00
|
|
|
"github.com/hashicorp/go-plugin/internal/plugin"
|
2018-12-05 20:27:05 +01: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-02-13 00:27:56 +01:00
|
|
|
func (s *grpcControllerServer) Shutdown(ctx context.Context, _ *plugin.Empty) (*plugin.Empty, error) {
|
|
|
|
resp := &plugin.Empty{}
|
2018-12-05 20:27:05 +01:00
|
|
|
|
|
|
|
// TODO: figure out why GracefullStop doesn't work.
|
|
|
|
s.server.Stop()
|
|
|
|
return resp, nil
|
|
|
|
}
|