Skip to content

Commit eef27d1

Browse files
committed
Break inventory handler recursion.
1 parent c87efb4 commit eef27d1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/protocols/protocol_block_out.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ void protocol_block_out::handle_send_next(const code& ec,
413413

414414
BITCOIN_ASSERT(!inventory->inventories().empty());
415415
inventory->inventories().pop_back();
416-
send_next_data(inventory);
416+
417+
// Break off recursion.
418+
DISPATCH_CONCURRENT1(send_next_data, inventory);
417419
}
418420

419421
// Subscription.

src/protocols/protocol_transaction_out.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ void protocol_transaction_out::send_transaction(const code& ec,
194194
BITCOIN_ASSERT(!inventory->inventories().empty());
195195
const not_found reply{ inventory->inventories().back() };
196196
SEND2(reply, handle_send, _1, reply.command);
197-
198-
// TODO: recursion hazard.
199197
handle_send_next(error::success, inventory);
200198
return;
201199
}
@@ -220,7 +218,9 @@ void protocol_transaction_out::handle_send_next(const code& ec,
220218

221219
BITCOIN_ASSERT(!inventory->inventories().empty());
222220
inventory->inventories().pop_back();
223-
send_next_data(inventory);
221+
222+
// Break off recursion.
223+
DISPATCH_CONCURRENT1(send_next_data, inventory);
224224
}
225225

226226
// Subscription.

0 commit comments

Comments
 (0)