Commit 175ba34a authored by Dominik Charousset's avatar Dominik Charousset

Fix response promise issue with capture-by-value

parent d9bff303
...@@ -55,7 +55,7 @@ class response_promise { ...@@ -55,7 +55,7 @@ class response_promise {
/** /**
* Sends `response_message` and invalidates this handle afterwards. * Sends `response_message` and invalidates this handle afterwards.
*/ */
void deliver(message response_message); void deliver(message response_message) const;
private: private:
actor_addr m_from; actor_addr m_from;
......
...@@ -32,14 +32,13 @@ response_promise::response_promise(const actor_addr& from, const actor_addr& to, ...@@ -32,14 +32,13 @@ response_promise::response_promise(const actor_addr& from, const actor_addr& to,
CAF_REQUIRE(id.is_response() || !id.valid()); CAF_REQUIRE(id.is_response() || !id.valid());
} }
void response_promise::deliver(message msg) { void response_promise::deliver(message msg) const {
if (!m_to) { if (!m_to) {
return; return;
} }
auto to = actor_cast<abstract_actor_ptr>(m_to); auto to = actor_cast<abstract_actor_ptr>(m_to);
auto from = actor_cast<abstract_actor_ptr>(m_from); auto from = actor_cast<abstract_actor_ptr>(m_from);
to->enqueue(m_from, m_id, move(msg), from->m_host); to->enqueue(m_from, m_id, move(msg), from->m_host);
m_to = invalid_actor_addr;
} }
} // namespace caf } // namespace caf
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment