Skip to content

Commit 33a729d

Browse files
authored
Merge pull request #915 from evoskuil/master
Clean up use of channel trackers, style, use inline.
2 parents 8fc93bc + bc1c7f6 commit 33a729d

16 files changed

+61
-44
lines changed

include/bitcoin/node/channels/channel.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class BCN_API channel
3636
DELETE_COPY_MOVE_DESTRUCT(channel);
3737

3838
protected:
39-
channel(const network::logger&, const network::socket::ptr&, uint64_t,
40-
const node::configuration&) NOEXCEPT
39+
inline channel(const network::logger&, const network::socket::ptr&,
40+
uint64_t, const node::configuration&) NOEXCEPT
4141
{
4242
}
4343
};

include/bitcoin/node/channels/channel_http.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ namespace node {
2929

3030
class BCN_API channel_http
3131
: public node::channel,
32-
public network::channel_http
32+
public network::channel_http,
33+
protected network::tracker<channel_http>
3334
{
3435
public:
35-
typedef std::shared_ptr<node::channel_http> ptr;
36+
typedef std::shared_ptr<channel_http> ptr;
3637

37-
channel_http(const network::logger& log,
38+
inline channel_http(const network::logger& log,
3839
const network::socket::ptr& socket, uint64_t identifier,
3940
const node::configuration& config, const options_t& options) NOEXCEPT
4041
: node::channel(log, socket, identifier, config),
41-
network::channel_http(log, socket, identifier, config.network, options)
42+
network::channel_http(log, socket, identifier, config.network, options),
43+
network::tracker<channel_http>(log)
4244
{
4345
}
4446
};

include/bitcoin/node/channels/channel_peer.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@ namespace node {
3030
/// Abstract base peer channel state for the node.
3131
class BCN_API channel_peer
3232
: public node::channel,
33-
public network::channel_peer
33+
public network::channel_peer,
34+
protected network::tracker<channel_peer>
3435
{
3536
public:
36-
typedef std::shared_ptr<node::channel_peer> ptr;
37+
typedef std::shared_ptr<channel_peer> ptr;
3738

38-
channel_peer(network::memory& allocator, const network::logger& log,
39+
inline channel_peer(network::memory& allocator, const network::logger& log,
3940
const network::socket::ptr& socket, uint64_t identifier,
4041
const node::configuration& config, const options_t& options) NOEXCEPT
4142
: node::channel(log, socket, identifier, config),
4243
network::channel_peer(allocator, log, socket, identifier,
4344
config.network, options),
44-
announced_(config.node.announcement_cache)
45+
announced_(config.node.announcement_cache),
46+
network::tracker<channel_peer>(log)
4547
{
4648
}
4749

include/bitcoin/node/channels/channel_tcp.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ namespace node {
3131
/// This is a placeholder for electrum, bitcoind, and stratum v1/v2 channels.
3232
class BCN_API channel_tcp
3333
: public node::channel,
34-
public network::channel
34+
public network::channel,
35+
protected network::tracker<channel_tcp>
3536
{
3637
public:
37-
typedef std::shared_ptr<node::channel_tcp> ptr;
38+
typedef std::shared_ptr<channel_tcp> ptr;
3839

39-
channel_tcp(const network::logger& log, const network::socket::ptr& socket,
40-
uint64_t identifier, const node::configuration& config,
41-
const options_t& options) NOEXCEPT
40+
inline channel_tcp(const network::logger& log,
41+
const network::socket::ptr& socket, uint64_t identifier,
42+
const node::configuration& config, const options_t& options) NOEXCEPT
4243
: node::channel(log, socket, identifier, config),
43-
network::channel(log, socket, identifier, config.network, options)
44+
network::channel(log, socket, identifier, config.network, options),
45+
network::tracker<channel_tcp>(log)
4446
{
4547
}
4648
};

include/bitcoin/node/channels/channel_ws.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ namespace node {
2929

3030
class BCN_API channel_ws
3131
: public node::channel,
32-
public network::channel_ws
32+
public network::channel_ws,
33+
protected network::tracker<channel_ws>
3334
{
3435
public:
3536
typedef std::shared_ptr<node::channel_ws> ptr;
@@ -74,7 +75,8 @@ class BCN_API channel_ws
7475
const network::socket::ptr& socket, uint64_t identifier,
7576
const node::configuration& config, const options_t& options) NOEXCEPT
7677
: node::channel(log, socket, identifier, config),
77-
network::channel_ws(log, socket, identifier, config.network, options)
78+
network::channel_ws(log, socket, identifier, config.network, options),
79+
network::tracker<channel_ws>(log)
7880
{
7981
}
8082

include/bitcoin/node/protocols/protocol_bitcoind.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class BCN_API protocol_bitcoind
3434
public:
3535
typedef std::shared_ptr<protocol_bitcoind> ptr;
3636

37-
protocol_bitcoind(const auto& session,
37+
inline protocol_bitcoind(const auto& session,
3838
const network::channel::ptr& channel,
3939
const options_t& options) NOEXCEPT
4040
: node::protocol_http(session, channel, options),
@@ -43,7 +43,7 @@ class BCN_API protocol_bitcoind
4343
}
4444

4545
/// Public start is required.
46-
void start() NOEXCEPT override
46+
inline void start() NOEXCEPT override
4747
{
4848
node::protocol_http::start();
4949
}

include/bitcoin/node/protocols/protocol_electrum.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class BCN_API protocol_electrum
3434
public:
3535
typedef std::shared_ptr<protocol_electrum> ptr;
3636

37-
protocol_electrum(const auto& session,
37+
inline protocol_electrum(const auto& session,
3838
const network::channel::ptr& channel,
3939
const options_t& options) NOEXCEPT
4040
: node::protocol_tcp(session, channel, options),
@@ -43,7 +43,7 @@ class BCN_API protocol_electrum
4343
}
4444

4545
/// Public start is required.
46-
void start() NOEXCEPT override
46+
inline void start() NOEXCEPT override
4747
{
4848
node::protocol_tcp::start();
4949
}

include/bitcoin/node/protocols/protocol_explore.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class BCN_API protocol_explore
3838
using interface = interface::explore;
3939
using dispatcher = network::rpc::dispatcher<interface>;
4040

41-
protocol_explore(const auto& session,
41+
inline protocol_explore(const auto& session,
4242
const network::channel::ptr& channel,
4343
const options_t& options) NOEXCEPT
4444
: node::protocol_html(session, channel, options),

include/bitcoin/node/protocols/protocol_html.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,22 @@ namespace node {
3030
/// Abstract base for HTML protocols, thread safe.
3131
class BCN_API protocol_html
3232
: public node::protocol,
33-
public network::protocol_http
33+
public network::protocol_http,
34+
protected network::tracker<protocol_html>
3435
{
3536
public:
3637
/// http channel, but html settings.
3738
using options_t = server::settings::html_server;
3839
using channel_t = node::channel_http;
3940

4041
protected:
41-
protocol_html(const auto& session,
42+
inline protocol_html(const auto& session,
4243
const network::channel::ptr& channel,
4344
const options_t& options) NOEXCEPT
4445
: node::protocol(session, channel),
4546
network::protocol_http(session, channel, options),
46-
options_(options)
47+
options_(options),
48+
network::tracker<protocol_html>(session->log)
4749
{
4850
}
4951

include/bitcoin/node/protocols/protocol_http.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class BCN_API protocol_http
4040
using channel_t = node::channel_http;
4141

4242
protected:
43-
protocol_http(const auto& session,
43+
inline protocol_http(const auto& session,
4444
const network::channel::ptr& channel,
4545
const options_t& options) NOEXCEPT
4646
: node::protocol(session, channel),

0 commit comments

Comments
 (0)