Skip to content

Commit

Permalink
Comments on racer behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed May 22, 2024
1 parent b436284 commit a91393e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
8 changes: 5 additions & 3 deletions include/bitcoin/network/async/race_quality.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ namespace libbitcoin {
namespace network {

/// Not thread safe.
/// Race is a bind that invokes handler with the first set of arguments
/// but only after a preconfigured number of invocations. This assists in
/// synchronizing the results of a set of racing asynchronous operations.
/// Used in outbound session to invoke for first succeesful handshake.
/// race_quality invokes complete(args) provided at start(complete), with
/// args from first successful call to finish(args), with success determined
/// by first argument in 'args', or upon the last expected invocation of
/// finish(...), based on the constructor 'size' parameter.
template <typename... Args>
class race_quality final
{
Expand Down
7 changes: 4 additions & 3 deletions include/bitcoin/network/async/race_speed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ namespace libbitcoin {
namespace network {

/// Not thread safe.
/// Race is a bind that invokes handler with the first set of arguments
/// but only after a preconfigured number of invocations. This assists in
/// synchronizing the results of a set of racing asynchronous operations.
/// Used in connector to race between timer (connection timeout) and connect.
/// race_speed<Size> invokes complete(args) provided at start(complete), with
/// args from first call to finish(args), upon the last expected invocation of
/// finish(...) based on the templatized Size number of expected calls.
template <size_t Size, typename... Args>
class race_speed final
{
Expand Down
10 changes: 7 additions & 3 deletions include/bitcoin/network/async/race_volume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ namespace libbitcoin {
namespace network {

/// Not thread safe.
/// Race is a bind that invokes handler with the first set of arguments
/// but only after a preconfigured number of invocations. This assists in
/// synchronizing the results of a set of racing asynchronous operations.
/// Used in seed session to continue once sufficient seeding has occurred.
/// race_volume<Success, Fail>(size, required) invokes sufficient(Success)
/// provided at start(sufficient, complete) when the first call to finish(count)
/// is made where count >= required. If no finish is sufficient then the final
/// call to finish, based on the constructor 'size' parameter, invokes
/// sufficient(Fail). The final call also invokes complete(Success), regardless
/// of sufficiency.
template <error::error_t Success, error::error_t Fail>
class race_volume final
{
Expand Down

0 comments on commit a91393e

Please sign in to comment.