in plugins/internal/plugin/device_plugin.go [200:217]
func (p *DevicePlugin) StopServer() {
// If StopServer() is called before StartServer() then do nothing
if p.server == nil {
return
}
// Stop the ListAndWatch streaming RPC if it is running
close(p.stopListWatch)
// Stop watching our Unix socket for deletion events
p.endpointDeleted.Cancel()
// Attempt to perform a graceful shutdown of the server (this will delete the Unix socket)
p.logger.Info("Gracefully stopping the gRPC server")
p.server.GracefulStop()
p.server = nil
}