TARAXA
|
Representation of connectivity state and all other pertinent Peer metadata. A Peer represents connectivity between two nodes, which in this case, are the host and remote nodes. More...
#include <Peer.h>
Public Types | |
using | instant_t = std::chrono::system_clock::time_point |
Public Member Functions | |
Peer (Node const &_node) | |
Construct Peer from Node. More... | |
Peer (Peer const &) | |
bool | shouldReconnect () const |
Return true if connection attempt should be made to this peer or false if. More... | |
bool | isUseless () const |
unsigned | fallbackSeconds () const |
Public Member Functions inherited from dev::p2p::Node | |
virtual | ~Node ()=default |
Node (Node const &) | |
Node (Public _publicKey, NodeIPEndpoint const &_ip, PeerType _peerType=PeerType::Optional) | |
Node (NodeSpec const &_s, PeerType _peerType=PeerType::Optional) | |
NodeID const & | address () const |
NodeIPEndpoint | get_endpoint () const |
void | set_endpoint (NodeIPEndpoint endpoint) |
operator bool () const | |
Public Attributes | |
std::atomic< instant_t > | m_lastConnected |
Network Availability. More... | |
std::atomic< instant_t > | m_lastAttempted |
std::atomic< unsigned > | m_failedAttempts {0} |
std::atomic< DisconnectReason > | m_lastDisconnect = NoDisconnect |
Reason for disconnect that happened last. More... | |
std::atomic< HandshakeFailureReason > | m_lastHandshakeFailure |
Public Attributes inherited from dev::p2p::Node | |
NodeID const | id |
std::atomic< PeerType > | peerType {PeerType::Optional} |
std::atomic< uint16_t > | external_udp_port |
Representation of connectivity state and all other pertinent Peer metadata. A Peer represents connectivity between two nodes, which in this case, are the host and remote nodes.
State information necessary for loading network topology is maintained by NodeTable.
Implement 'bool required'
reputation: Move score, rating to capability-specific map (&& remove friend class)
reputation: implement via origin-tagged events
Populate metadata upon construction; save when destroyed.
Metadata for peers needs to be handled via a storage backend. Specifically, peers can be utilized in a variety of many-to-many relationships while also needing to modify shared instances of those peers. Modifying these properties via a storage backend alleviates Host of the responsibility. (&& remove save/restoreNetwork)
reimplement recording of historical session information on per-transport basis
move attributes into protected
using dev::p2p::Peer::instant_t = std::chrono::system_clock::time_point |
dev::p2p::Peer::Peer | ( | Peer const & | _original | ) |
unsigned dev::p2p::Peer::fallbackSeconds | ( | ) | const |
Returns number of seconds to wait until attempting connection, based on attempted connection history
bool dev::p2p::Peer::isUseless | ( | ) | const |
A peer which should never be reconnected to - e.g. it's running on a different network, we don't have any common capabilities
bool dev::p2p::Peer::shouldReconnect | ( | ) | const |
Return true if connection attempt should be made to this peer or false if.
std::atomic<unsigned> dev::p2p::Peer::m_failedAttempts {0} |
std::atomic<instant_t> dev::p2p::Peer::m_lastAttempted |
std::atomic<DisconnectReason> dev::p2p::Peer::m_lastDisconnect = NoDisconnect |
Reason for disconnect that happened last.
std::atomic<HandshakeFailureReason> dev::p2p::Peer::m_lastHandshakeFailure |
Reason for most recent handshake failure