From b14c1a7f877942fe61937157aa38a584329ef854 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 23 Mar 2024 23:55:58 -0400 Subject: [PATCH 1/2] Rename event parameter to event_. --- include/bitcoin/network/log/logger.hpp | 4 ++-- src/log/logger.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/bitcoin/network/log/logger.hpp b/include/bitcoin/network/log/logger.hpp index d8a577585..d6d3bd88a 100644 --- a/include/bitcoin/network/log/logger.hpp +++ b/include/bitcoin/network/log/logger.hpp @@ -101,10 +101,10 @@ class BCT_API logger final writer write(uint8_t level) const NOEXCEPT; /// Fire event with optional value, recorded with current time. - void fire(uint8_t event, uint64_t value=zero) const NOEXCEPT; + void fire(uint8_t event_, uint64_t value=zero) const NOEXCEPT; /// Fire event with nanosecond duration value, recorded with current time. - void span(uint8_t event, const time& started) const NOEXCEPT; + void span(uint8_t event_, const time& started) const NOEXCEPT; /// If stopped, handler is invoked with error::subscriber_stopped/defaults /// and dropped. Otherwise it is held until stop/drop. False if failed. diff --git a/src/log/logger.cpp b/src/log/logger.cpp index e445a2ebf..64bc2ee6b 100644 --- a/src/log/logger.cpp +++ b/src/log/logger.cpp @@ -138,25 +138,25 @@ void logger::do_subscribe_messages(const message_notifier& handler) NOEXCEPT // events // ---------------------------------------------------------------------------- -void logger::span(uint8_t event, const time& started) const NOEXCEPT +void logger::span(uint8_t event_, const time& started) const NOEXCEPT { // value parameter is time span in nanoseconds. - fire(event, (now() - started).count()); + fire(event_, (now() - started).count()); } -void logger::fire(uint8_t event, uint64_t value) const NOEXCEPT +void logger::fire(uint8_t event_, uint64_t value) const NOEXCEPT { boost::asio::post(strand_, std::bind(&logger::do_notify_event, - this, event, value, fine_clock::now())); + this, event_, value, fine_clock::now())); } // private -void logger::do_notify_event(uint8_t event, uint64_t value, +void logger::do_notify_event(uint8_t event_, uint64_t value, const time& point) const NOEXCEPT { BC_ASSERT_MSG(stranded(), "strand"); - event_subscriber_.notify(error::success, event, value, point); + event_subscriber_.notify(error::success, event_, value, point); } void logger::subscribe_events(event_notifier&& handler) NOEXCEPT From 13af8394d2fb53708f1239cdb8803bff6abc2fd0 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 23 Mar 2024 23:56:26 -0400 Subject: [PATCH 2/2] Remove unnecessary session forward declaration. --- .../bitcoin/network/protocols/protocol_address_in_31402.hpp | 3 +-- .../bitcoin/network/protocols/protocol_address_out_31402.hpp | 3 +-- include/bitcoin/network/protocols/protocol_alert_31402.hpp | 3 +-- include/bitcoin/network/protocols/protocol_ping_31402.hpp | 3 +-- include/bitcoin/network/protocols/protocol_ping_60001.hpp | 3 +-- include/bitcoin/network/protocols/protocol_reject_70002.hpp | 3 +-- include/bitcoin/network/protocols/protocol_seed_31402.hpp | 4 +--- include/bitcoin/network/protocols/protocol_version_31402.hpp | 3 +-- include/bitcoin/network/protocols/protocol_version_70001.hpp | 3 +-- include/bitcoin/network/protocols/protocol_version_70002.hpp | 3 +-- 10 files changed, 10 insertions(+), 21 deletions(-) diff --git a/include/bitcoin/network/protocols/protocol_address_in_31402.hpp b/include/bitcoin/network/protocols/protocol_address_in_31402.hpp index 4b871607f..40e39e88c 100644 --- a/include/bitcoin/network/protocols/protocol_address_in_31402.hpp +++ b/include/bitcoin/network/protocols/protocol_address_in_31402.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_address_in_31402 : public protocol, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_address_out_31402.hpp b/include/bitcoin/network/protocols/protocol_address_out_31402.hpp index 9eef56697..29326f4fd 100644 --- a/include/bitcoin/network/protocols/protocol_address_out_31402.hpp +++ b/include/bitcoin/network/protocols/protocol_address_out_31402.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_address_out_31402 : public protocol, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_alert_31402.hpp b/include/bitcoin/network/protocols/protocol_alert_31402.hpp index 94a4af2fb..1b6728e68 100644 --- a/include/bitcoin/network/protocols/protocol_alert_31402.hpp +++ b/include/bitcoin/network/protocols/protocol_alert_31402.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_alert_31402 : public protocol, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_ping_31402.hpp b/include/bitcoin/network/protocols/protocol_ping_31402.hpp index 6b15539a9..485b0360e 100644 --- a/include/bitcoin/network/protocols/protocol_ping_31402.hpp +++ b/include/bitcoin/network/protocols/protocol_ping_31402.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_ping_31402 : public protocol, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_ping_60001.hpp b/include/bitcoin/network/protocols/protocol_ping_60001.hpp index 55fa78fc0..926fe21d3 100644 --- a/include/bitcoin/network/protocols/protocol_ping_60001.hpp +++ b/include/bitcoin/network/protocols/protocol_ping_60001.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_ping_60001 : public protocol_ping_31402, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_reject_70002.hpp b/include/bitcoin/network/protocols/protocol_reject_70002.hpp index d0fb07c52..995e4f855 100644 --- a/include/bitcoin/network/protocols/protocol_reject_70002.hpp +++ b/include/bitcoin/network/protocols/protocol_reject_70002.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_reject_70002 : public protocol, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_seed_31402.hpp b/include/bitcoin/network/protocols/protocol_seed_31402.hpp index dbd42c561..5eb511a53 100644 --- a/include/bitcoin/network/protocols/protocol_seed_31402.hpp +++ b/include/bitcoin/network/protocols/protocol_seed_31402.hpp @@ -27,12 +27,10 @@ #include #include #include +#include namespace libbitcoin { namespace network { - -class session; - class BCT_API protocol_seed_31402 : public protocol, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_version_31402.hpp b/include/bitcoin/network/protocols/protocol_version_31402.hpp index a62f3c878..542223c20 100644 --- a/include/bitcoin/network/protocols/protocol_version_31402.hpp +++ b/include/bitcoin/network/protocols/protocol_version_31402.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_version_31402 : public protocol, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_version_70001.hpp b/include/bitcoin/network/protocols/protocol_version_70001.hpp index 18a29eea7..bab1d1c3c 100644 --- a/include/bitcoin/network/protocols/protocol_version_70001.hpp +++ b/include/bitcoin/network/protocols/protocol_version_70001.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_version_70001 : public protocol_version_31402, protected tracker { diff --git a/include/bitcoin/network/protocols/protocol_version_70002.hpp b/include/bitcoin/network/protocols/protocol_version_70002.hpp index 136ae7cef..cc2055f78 100644 --- a/include/bitcoin/network/protocols/protocol_version_70002.hpp +++ b/include/bitcoin/network/protocols/protocol_version_70002.hpp @@ -27,12 +27,11 @@ #include #include #include +#include namespace libbitcoin { namespace network { -class session; - class BCT_API protocol_version_70002 : public protocol_version_70001, protected tracker {