Commit b9ee7c32 authored by Dominik Charousset's avatar Dominik Charousset

Fix minor issues in example code

parent a6cf6260
...@@ -43,7 +43,7 @@ bool from_string(caf::string_view in, fixed_stack_errc& out) { ...@@ -43,7 +43,7 @@ bool from_string(caf::string_view in, fixed_stack_errc& out) {
} }
bool from_integer(uint8_t in, fixed_stack_errc& out) { bool from_integer(uint8_t in, fixed_stack_errc& out) {
if (in > 0 && in < 1) { if (in > 0 && in < 3) {
out = static_cast<fixed_stack_errc>(in); out = static_cast<fixed_stack_errc>(in);
return true; return true;
} else { } else {
......
...@@ -16,7 +16,8 @@ adder_actor::behavior_type server_impl(adder_actor::pointer self, ...@@ -16,7 +16,8 @@ adder_actor::behavior_type server_impl(adder_actor::pointer self,
[=](add_atom, int32_t y, int32_t z) { [=](add_atom, int32_t y, int32_t z) {
auto rp = self->make_response_promise<int32_t>(); auto rp = self->make_response_promise<int32_t>();
self->request(worker, infinite, add_atom_v, y, z) self->request(worker, infinite, add_atom_v, y, z)
.then([rp](int32_t result) mutable { rp.deliver(result); }); .then([rp](int32_t result) mutable { rp.deliver(result); },
[rp](error& err) mutable { rp.deliver(std::move(err)); });
return rp; return rp;
}, },
}; };
......
...@@ -13,9 +13,11 @@ namespace { ...@@ -13,9 +13,11 @@ namespace {
behavior ping(event_based_actor* self, actor pong_actor, int n) { behavior ping(event_based_actor* self, actor pong_actor, int n) {
self->send(pong_actor, ping_atom_v, n); self->send(pong_actor, ping_atom_v, n);
return { return {
[=](pong_atom, int x) { [=](pong_atom, int x) -> result<ping_atom, int> {
if (x > 1) if (x > 1)
self->send(pong_actor, ping_atom_v, x - 1); return {ping_atom_v, x - 1};
else
return {};
}, },
}; };
} }
......
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