Skip to content
Snippets Groups Projects
Commit a38a15ea authored by Michael Davis's avatar Michael Davis
Browse files

[EOS-CTA] Allocates Alerts on the heap

Alert objects are self-destructing after they are sent (or cancelled)
parent c3cd70d1
Branches
Tags
No related merge requests found
......@@ -154,16 +154,16 @@ void RequestProc<eos::wfe::Notification, eos::wfe::Response, eos::wfe::Alert>::E
template <>
void RequestProc<eos::wfe::Notification, eos::wfe::Response, eos::wfe::Alert>::ExecuteAlerts()
{
// Set alert message
// Allocate alert messages on the heap, they are self-destructing
m_alert.set_audience(eos::wfe::Alert::EOSLOG);
m_alert.set_message("Something bad happened");
auto *alert_msg = new eos::wfe::Alert();
// Send the alert message
alert_msg->set_audience(eos::wfe::Alert::EOSLOG);
alert_msg->set_message("Something bad happened");
Alert(m_alert);
// Send the alert message
// If we want to allow an arbitrary number of alerts, note that m_alert is not reusable (needs a container)
Alert(*alert_msg);
}
......
......@@ -103,7 +103,6 @@ private:
RequestType m_request;
MetadataType m_metadata;
AlertType m_alert;
// Metadata and Response buffers must stay in scope until Finished() is called, so they need to be member variables
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment