Skip to content

Commit

Permalink
GH-284 Use recursive lambda to repost if not complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Oct 10, 2024
1 parent dd5a078 commit eae3367
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3775,11 +3775,21 @@ namespace eosio {
if (best_head) {
++c->unique_blocks_rcvd_count;
fc_dlog(logger, "posting incoming_block to app thread, block ${n}", ("n", ptr->block_num()));

auto process_incoming_blocks = [](auto self) -> void {
try {
auto r = my_impl->producer_plug->on_incoming_block();
if (r == controller::apply_blocks_result::incomplete) {
app().executor().post(handler_id::process_incoming_block, priority::medium, exec_queue::read_write, [self]() {
self(self);
});
}
} catch (...) {} // errors on applied blocks logged in controller
};

app().executor().post(handler_id::process_incoming_block, priority::medium, exec_queue::read_write,
[]() {
try {
my_impl->producer_plug->on_incoming_block();
} catch (...) {} // errors on applied blocks logged in controller
[process_incoming_blocks]() {
process_incoming_blocks(process_incoming_blocks);
});

// ready to process immediately, so signal producer to interrupt start_block
Expand Down

0 comments on commit eae3367

Please sign in to comment.