Fabcoin Core
0.16.2
P2P Digital Currency
|
Representation of connectivity state and all other pertinent Peer metadata. More...
#include <Peer.h>
Public Member Functions | |
Peer (Node const &_node) | |
Construct Peer from Node. More... | |
bool | isOffline () const |
virtual bool | operator< (Peer const &_p) const |
int | rating () const |
WIP: Returns current peer rating. More... | |
bool | shouldReconnect () const |
Return true if connection attempt should be made to this peer or false if. More... | |
int | failedAttempts () const |
Number of times connection has been attempted to peer. More... | |
DisconnectReason | lastDisconnect () const |
Reason peer was previously disconnected. More... | |
void | noteSessionGood () |
Peer session is noted as useful. More... | |
Public Member Functions inherited from dev::p2p::Node | |
Node ()=default | |
Node (Node const &)=default | |
Node (Public _publicKey, NodeIPEndpoint const &_ip, PeerType _peerType=PeerType::Optional) | |
Node (NodeSpec const &_s, PeerType _peerType=PeerType::Optional) | |
virtual NodeID const & | address () const |
virtual Public const & | publicKey () const |
virtual | operator bool () const |
Protected Member Functions | |
unsigned | fallbackSeconds () const |
Returns number of seconds to wait until attempting connection, based on attempted connection history. More... | |
Protected Attributes | |
int | m_score = 0 |
All time cumulative. More... | |
int | m_rating = 0 |
Trending. More... | |
std::chrono::system_clock::time_point | m_lastConnected |
Network Availability. More... | |
std::chrono::system_clock::time_point | m_lastAttempted |
unsigned | m_failedAttempts = 0 |
DisconnectReason | m_lastDisconnect = NoDisconnect |
Reason for disconnect that happened last. More... | |
std::weak_ptr< Session > | m_session |
Used by isOffline() and (todo) for peer to emit session information. More... | |
Friends | |
class | Session |
class | Host |
Allows Session to update score and rating. More... | |
class | RLPXHandshake |
For Host: saveNetwork(), restoreNetwork() More... | |
Additional Inherited Members | |
Public Attributes inherited from dev::p2p::Node | |
NodeID | id |
NodeIPEndpoint | endpoint |
Endpoints by which we expect to reach node. More... | |
PeerType | peerType = PeerType::Optional |
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
|
inline |
|
inline |
|
protected |
|
inline |
|
inline |
|
inline |
|
virtual |
|
inline |
bool dev::p2p::Peer::shouldReconnect | ( | ) | const |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Used by isOffline() and (todo) for peer to emit session information.