Commit e768dd2a authored by Dominik Charousset's avatar Dominik Charousset

fixed chaining in case an actor sends to itself

parent a043ea85
...@@ -65,11 +65,12 @@ struct destination_header { ...@@ -65,11 +65,12 @@ struct destination_header {
*/ */
inline void send_tuple(destination_header hdr, any_tuple what) { inline void send_tuple(destination_header hdr, any_tuple what) {
if (hdr.receiver == nullptr) return; if (hdr.receiver == nullptr) return;
message_header fhdr{self, std::move(hdr.receiver), hdr.priority}; auto s = self.get();
if (self->chaining_enabled()) { message_header fhdr{s, std::move(hdr.receiver), hdr.priority};
if (fhdr.receiver != s && s->chaining_enabled()) {
if (fhdr.receiver->chained_enqueue(fhdr, std::move(what))) { if (fhdr.receiver->chained_enqueue(fhdr, std::move(what))) {
// only actors implement chained_enqueue to return true // only actors implement chained_enqueue to return true
self->chained_actor(fhdr.receiver.downcast<actor>()); s->chained_actor(fhdr.receiver.downcast<actor>());
} }
} }
else fhdr.deliver(std::move(what)); else fhdr.deliver(std::move(what));
......
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