Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ src_libbitcoin_node_la_SOURCES = \
src/sessions/session.cpp \
src/sessions/session_inbound.cpp \
src/sessions/session_manual.cpp \
src/sessions/session_outbound.cpp \
src/sessions/session_tcp.cpp
src/sessions/session_outbound.cpp

# local: test/libbitcoin-node-test
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -243,7 +242,6 @@ include_bitcoin_node_sessions_HEADERS = \
include/bitcoin/node/sessions/session_outbound.hpp \
include/bitcoin/node/sessions/session_peer.hpp \
include/bitcoin/node/sessions/session_server.hpp \
include/bitcoin/node/sessions/session_tcp.hpp \
include/bitcoin/node/sessions/sessions.hpp

# files => ${bash_completiondir}
Expand Down
3 changes: 1 addition & 2 deletions builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ add_library( ${CANONICAL_LIB_NAME}
"../../src/sessions/session.cpp"
"../../src/sessions/session_inbound.cpp"
"../../src/sessions/session_manual.cpp"
"../../src/sessions/session_outbound.cpp"
"../../src/sessions/session_tcp.cpp" )
"../../src/sessions/session_outbound.cpp" )

# ${CANONICAL_LIB_NAME} project specific include directory normalization for build.
#------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
<ClCompile Include="..\..\..\..\src\sessions\session_inbound.cpp" />
<ClCompile Include="..\..\..\..\src\sessions\session_manual.cpp" />
<ClCompile Include="..\..\..\..\src\sessions\session_outbound.cpp" />
<ClCompile Include="..\..\..\..\src\sessions\session_tcp.cpp" />
<ClCompile Include="..\..\..\..\src\settings.cpp" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -228,7 +227,6 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_outbound.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_peer.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_server.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_tcp.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\sessions.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\settings.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\version.hpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@
<ClCompile Include="..\..\..\..\src\sessions\session_outbound.cpp">
<Filter>src\sessions</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\sessions\session_tcp.cpp">
<Filter>src\sessions</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\settings.cpp">
<Filter>src</Filter>
</ClCompile>
Expand Down Expand Up @@ -377,9 +374,6 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_server.hpp">
<Filter>include\bitcoin\node\sessions</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_tcp.hpp">
<Filter>include\bitcoin\node\sessions</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\sessions.hpp">
<Filter>include\bitcoin\node\sessions</Filter>
</ClInclude>
Expand Down
1 change: 0 additions & 1 deletion include/bitcoin/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
#include <bitcoin/node/sessions/session_outbound.hpp>
#include <bitcoin/node/sessions/session_peer.hpp>
#include <bitcoin/node/sessions/session_server.hpp>
#include <bitcoin/node/sessions/session_tcp.hpp>
#include <bitcoin/node/sessions/sessions.hpp>

#endif
9 changes: 4 additions & 5 deletions include/bitcoin/node/channels/channel_http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@
namespace libbitcoin {
namespace node {

/// Abstract base HTTP channel state for the node.
class BCN_API channel_http
: public network::channel_http,
public node::channel
: public node::channel,
public network::channel_http
{
public:
typedef std::shared_ptr<node::channel_http> ptr;

channel_http(const network::logger& log,
const network::socket::ptr& socket, uint64_t identifier,
const node::configuration& config, const options_t& options) NOEXCEPT
: network::channel_http(log, socket, identifier, config.network, options),
node::channel(log, socket, identifier, config)
: node::channel(log, socket, identifier, config),
network::channel_http(log, socket, identifier, config.network, options)
{
}
};
Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/node/channels/channel_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ namespace node {

/// Abstract base peer channel state for the node.
class BCN_API channel_peer
: public network::channel_peer,
public node::channel
: public node::channel,
public network::channel_peer
{
public:
typedef std::shared_ptr<node::channel_peer> ptr;

channel_peer(network::memory& allocator, const network::logger& log,
const network::socket::ptr& socket, uint64_t identifier,
const node::configuration& config, const options_t& options) NOEXCEPT
: network::channel_peer(allocator, log, socket, identifier,
: node::channel(log, socket, identifier, config),
network::channel_peer(allocator, log, socket, identifier,
config.network, options),
node::channel(log, socket, identifier, config),
announced_(config.node.announcement_cache)
{
}
Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/node/channels/channel_tcp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ namespace node {

/// Abstract base TCP channel state for the node.
class BCN_API channel_tcp
: public network::channel_tcp,
public node::channel
: public node::channel,
public network::channel
{
public:
typedef std::shared_ptr<node::channel_tcp> ptr;

channel_tcp(const network::logger& log, const network::socket::ptr& socket,
uint64_t identifier, const node::configuration& config,
const options_t& options) NOEXCEPT
: network::channel_tcp(log, socket, identifier, config.network, options),
node::channel(log, socket, identifier, config)
: node::channel(log, socket, identifier, config),
network::channel(log, socket, identifier, config.network, options)
{
}
};
Expand Down
10 changes: 4 additions & 6 deletions include/bitcoin/node/channels/channel_ws.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,18 @@
namespace libbitcoin {
namespace node {

/// Abstract base websocket channel state for the node.
/// Does not inherit node::channel_http but does inherit network::channel_http.
class BCN_API channel_ws
: public network::channel_ws,
public node::channel
: public node::channel,
public network::channel_ws
{
public:
typedef std::shared_ptr<node::channel_ws> ptr;

channel_ws(const network::logger& log, const network::socket::ptr& socket,
uint64_t identifier, const node::configuration& config,
const options_t& options) NOEXCEPT
: network::channel_ws(log, socket, identifier, config.network, options),
node::channel(log, socket, identifier, config)
: node::channel(log, socket, identifier, config),
network::channel_ws(log, socket, identifier, config.network, options)
{
}
};
Expand Down
10 changes: 5 additions & 5 deletions include/bitcoin/node/protocols/protocol_html.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace node {

/// Abstract base for HTML protocols, thread safe.
class BCN_API protocol_html
: public network::protocol_http,
public node::protocol
: public node::protocol,
public network::protocol_http
{
public:
/// http channel, but html settings.
Expand All @@ -41,9 +41,9 @@ class BCN_API protocol_html
protocol_html(const auto& session,
const network::channel::ptr& channel,
const options_t& options) NOEXCEPT
: network::protocol_http(session, channel, options),
options_(options),
node::protocol(session, channel)
: node::protocol(session, channel),
network::protocol_http(session, channel, options),
options_(options)
{
}

Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/node/protocols/protocol_http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace node {

/// Abstract base for HTTP protocols, thread safe.
class BCN_API protocol_http
: public network::protocol_http,
public node::protocol
: public node::protocol,
public network::protocol_http
{
public:
// Replace base class channel_t (network::channel_http).
Expand All @@ -43,8 +43,8 @@ class BCN_API protocol_http
protocol_http(const auto& session,
const network::channel::ptr& channel,
const options_t& options) NOEXCEPT
: network::protocol_http(session, channel, options),
node::protocol(session, channel),
: node::protocol(session, channel),
network::protocol_http(session, channel, options),
channel_(std::static_pointer_cast<node::channel_tcp>(channel)),
session_(session)
{
Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/node/protocols/protocol_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace node {

/// Abstract base for node peer protocols, thread safe.
class BCN_API protocol_peer
: public network::protocol_peer,
public node::protocol
: public node::protocol,
public network::protocol_peer
{
public:
// Replace base class channel_t (network::channel_peer).
Expand All @@ -46,8 +46,8 @@ class BCN_API protocol_peer

protocol_peer(const auto& session,
const network::channel::ptr& channel) NOEXCEPT
: network::protocol_peer(session, channel),
node::protocol(session, channel),
: node::protocol(session, channel),
network::protocol_peer(session, channel),
channel_(std::static_pointer_cast<node::channel_peer>(channel)),
session_(session)
{
Expand Down
13 changes: 6 additions & 7 deletions include/bitcoin/node/protocols/protocol_tcp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@ namespace node {

/// Abstract base for TCP protocols, thread safe.
class BCN_API protocol_tcp
: public network::protocol_tcp,
public node::protocol
: public node::protocol,
public network::protocol
{
public:
// Replace base class channel_t (network::channel_tcp).
// Replace base class channel_t (network::channel).
using channel_t = node::channel_tcp;

protected:
protocol_tcp(const auto& session,
const network::channel::ptr& channel,
const options_t& options) NOEXCEPT
: network::protocol_tcp(session, channel, options),
node::protocol(session, channel),
const network::channel::ptr& channel, const options_t&) NOEXCEPT
: node::protocol(session, channel),
network::protocol(session, channel),
channel_(std::static_pointer_cast<node::channel_tcp>(channel)),
session_(session)
{
Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/node/protocols/protocol_ws.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace node {
// TODO: make this an intermediate base class for websocket.
// TODO: and then create a distinct concrete class for deployment.
class BCN_API protocol_ws
: public network::protocol_ws,
public node::protocol,
: public node::protocol,
public network::protocol_ws,
protected network::tracker<protocol_ws>
{
public:
Expand All @@ -42,8 +42,8 @@ class BCN_API protocol_ws
protocol_ws(const auto& session,
const network::channel::ptr& channel,
const options_t& options) NOEXCEPT
: network::protocol_ws(session, channel, options),
node::protocol(session, channel),
: node::protocol(session, channel),
network::protocol_ws(session, channel, options),
network::tracker<protocol_ws>(session->log)
{
}
Expand Down
1 change: 0 additions & 1 deletion include/bitcoin/node/sessions/session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace node {
class full_node;

/// Common session context, presumes will be joined with network::session.
/// This could be templatized on the sibling, but there only one implemented.
class BCN_API session
{
public:
Expand Down
20 changes: 10 additions & 10 deletions include/bitcoin/node/sessions/session_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ namespace node {
/// Template for network::session derivation with node::session.
/// node::session does not derive from network::session (siblings).
/// This avoids the diamond inheritance problem between network/node.
template <class Session>
template <class NetworkSession>
class session_peer
: public Session,
public node::session
: public node::session,
public NetworkSession
{
public:
typedef std::shared_ptr<session_peer<Session>> ptr;
using options_t = typename Session::options_t;
typedef std::shared_ptr<session_peer<NetworkSession>> ptr;
using options_t = typename NetworkSession::options_t;
using channel_t = node::channel_peer;

/// Construct an instance.
template <typename Node, typename... Args>
session_peer(Node& node, Args&&... args) NOEXCEPT
: Session(node, std::forward<Args>(args)...),
node::session(node)
: node::session(node),
NetworkSession(node, std::forward<Args>(args)...)
{
}

Expand Down Expand Up @@ -79,7 +79,7 @@ class session_peer
peer->set_start_height(top);

// Attach and execute appropriate version protocol.
Session::attach_handshake(channel, std::move(handler));
NetworkSession::attach_handshake(channel, std::move(handler));
}

void attach_protocols(const channel_ptr& channel) NOEXCEPT override
Expand All @@ -90,7 +90,7 @@ class session_peer
using namespace system;
using namespace network;
using namespace messages::peer;
using base = session_peer<Session>;
using base = session_peer<NetworkSession>;

const auto self = this->template shared_from_base<base>();
const auto relay = this->config().network.enable_relay;
Expand All @@ -108,7 +108,7 @@ class session_peer
));

// Attach appropriate alert, reject, ping, and/or address protocols.
Session::attach_protocols(channel);
NetworkSession::attach_protocols(channel);

// Channel suspensions.
channel->attach<protocol_observer>(self)->start();
Expand Down
Loading
Loading