Skip to content

Commit b033bf9

Browse files
authored
Merge pull request #890 from evoskuil/master
Refactor settings for uniform treatment of services.
2 parents 09581eb + b5fdf56 commit b033bf9

20 files changed

+567
-458
lines changed

console/executor_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ bool executor::do_run()
139139
logger(BN_NODE_INTERRUPT);
140140

141141
// Create node.
142-
metadata_.configured.network.initialize();
142+
metadata_.configured.network.manual.initialize();
143143
node_ = std::make_shared<full_node>(query_, metadata_.configured, log_);
144144

145145
// Subscribe node.

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&,
40-
const node::configuration&, uint64_t=zero) NOEXCEPT
39+
channel(const network::logger&, const network::socket::ptr&, uint64_t,
40+
const node::configuration&) NOEXCEPT
4141
{
4242
}
4343
};

include/bitcoin/node/channels/channel_http.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@ class BCN_API channel_http
3434
{
3535
public:
3636
typedef std::shared_ptr<node::channel_http> ptr;
37-
using options_t = network::channel_http::options_t;
3837

39-
channel_http(const network::logger& log, const network::socket::ptr& socket,
40-
const node::configuration& config, uint64_t identifier=zero,
41-
const options_t& options={}) NOEXCEPT
42-
: network::channel_http(log, socket, config.network, identifier, options),
43-
node::channel(log, socket, config, identifier)
38+
channel_http(const network::logger& log,
39+
const network::socket::ptr& socket, uint64_t identifier,
40+
const node::configuration& config, const options_t& options) NOEXCEPT
41+
: network::channel_http(log, socket, identifier, config.network, options),
42+
node::channel(log, socket, identifier, config)
4443
{
4544
}
4645
};

include/bitcoin/node/channels/channel_peer.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ class BCN_API channel_peer
3535
public:
3636
typedef std::shared_ptr<node::channel_peer> ptr;
3737

38-
channel_peer(network::memory& memory, const network::logger& log,
39-
const network::socket::ptr& socket, const node::configuration& config,
40-
uint64_t identifier=zero) NOEXCEPT
41-
: network::channel_peer(memory, log, socket, config.network, identifier),
42-
node::channel(log, socket, config, identifier),
38+
channel_peer(network::memory& allocator, const network::logger& log,
39+
const network::socket::ptr& socket, uint64_t identifier,
40+
const node::configuration& config, const options_t& options) NOEXCEPT
41+
: network::channel_peer(allocator, log, socket, identifier,
42+
config.network, options),
43+
node::channel(log, socket, identifier, config),
4344
announced_(config.node.announcement_cache)
4445
{
4546
}

include/bitcoin/node/channels/channel_tcp.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@ class BCN_API channel_tcp
3434
{
3535
public:
3636
typedef std::shared_ptr<node::channel_tcp> ptr;
37-
using options_t = network::channel_tcp::options_t;
3837

3938
channel_tcp(const network::logger& log, const network::socket::ptr& socket,
40-
const node::configuration& config, uint64_t identifier=zero,
41-
const options_t& options={}) NOEXCEPT
42-
: network::channel_tcp(log, socket, config.network, identifier, options),
43-
node::channel(log, socket, config, identifier)
39+
uint64_t identifier, const node::configuration& config,
40+
const options_t& options) NOEXCEPT
41+
: network::channel_tcp(log, socket, identifier, config.network, options),
42+
node::channel(log, socket, identifier, config)
4443
{
4544
}
4645
};

include/bitcoin/node/channels/channel_ws.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,12 @@ class BCN_API channel_ws
3535
{
3636
public:
3737
typedef std::shared_ptr<node::channel_ws> ptr;
38-
using options_t = network::channel_ws::options_t;
3938

40-
channel_ws(const network::logger& log,
41-
const network::socket::ptr& socket,
42-
const node::configuration& config, uint64_t identifier=zero,
43-
const options_t& options={}) NOEXCEPT
44-
: network::channel_ws(log, socket, config.network, identifier,
45-
options),
46-
node::channel(log, socket, config, identifier)
39+
channel_ws(const network::logger& log, const network::socket::ptr& socket,
40+
uint64_t identifier, const node::configuration& config,
41+
const options_t& options) NOEXCEPT
42+
: network::channel_ws(log, socket, identifier, config.network, options),
43+
node::channel(log, socket, identifier, config)
4744
{
4845
}
4946
};

include/bitcoin/node/chase.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ enum class chase
6161
/// Issued by 'session_outbound' and handled by 'block_in_31800'.
6262
split,
6363

64-
/// Channels (all with work) directed to split work and stop (channel_t).
64+
/// Channels (all with work) directed to split work and stop (peer_t).
6565
/// Issued by 'session_outbound' and handled by 'block_in_31800'.
6666
stall,
6767

68-
/// Channels (all with work) directed to drop work and stop (channel_t).
68+
/// Channels (all with work) directed to drop work and stop (peer_t).
6969
/// Issued by 'check' and handled by 'block_in_31800'.
7070
purge,
7171

include/bitcoin/node/define.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ using object_key = uint64_t;
7070
/// Event value types.
7171
using count_t = size_t;
7272
using height_t = size_t;
73-
using channel_t = uint64_t;
73+
using peer_t = uint64_t;
7474
using object_t = object_key;
7575
using header_t = database::header_link::integer;
7676
using transaction_t = database::tx_link::integer;

include/bitcoin/node/protocols/protocol_block_in_31800.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class BCN_API protocol_block_in_31800
6565

6666
/// Manage work splitting.
6767
bool is_idle() const NOEXCEPT override;
68-
virtual void do_purge(channel_t) NOEXCEPT;
69-
virtual void do_split(channel_t) NOEXCEPT;
68+
virtual void do_purge(peer_t) NOEXCEPT;
69+
virtual void do_split(peer_t) NOEXCEPT;
7070
virtual void do_report(count_t count) NOEXCEPT;
7171

7272
/// Check incoming block message.

include/bitcoin/node/protocols/protocol_block_out_70012.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class BCN_API protocol_block_out_70012
5050
const network::messages::peer::send_headers::cptr& message) NOEXCEPT;
5151

5252
private:
53-
// This is protected by strand.
54-
bool superseded_{};
53+
// This is thread safe.
54+
std::atomic_bool superseded_{};
5555
};
5656

5757
} // namespace node

0 commit comments

Comments
 (0)