in pkg/client/client_v2.go [844:867]
func (c *clientV2) actionsReader(
actionsClient proto.ElasticAgent_ActionsClient,
actionResults chan *proto.ActionResponse,
) {
action, err := actionsClient.Recv()
for ; err == nil; action, err = actionsClient.Recv() {
switch action.Type {
case proto.ActionRequest_CUSTOM:
c.tryPerformAction(actionResults, action)
case proto.ActionRequest_DIAGNOSTICS:
c.tryPerformDiagnostics(actionResults, action)
default:
actionResults <- &proto.ActionResponse{
Token: c.token,
Id: action.Id,
Status: proto.ActionResponse_FAILED,
Result: ActionTypeUnknown,
}
}
}
if !errors.Is(err, io.EOF) {
c.errCh <- err
}
}