1#ifndef XRPL_PEERFINDER_COUNTS_H_INCLUDED 
    2#define XRPL_PEERFINDER_COUNTS_H_INCLUDED 
    4#include <xrpld/peerfinder/PeerfinderManager.h> 
    5#include <xrpld/peerfinder/Slot.h> 
    6#include <xrpld/peerfinder/detail/Tuning.h> 
    8#include <xrpl/basics/random.h> 
   56            "ripple::PeerFinder::Counts::can_activate : valid input state");
 
 
  249                    "ripple::PeerFinder::Counts::adjust : input is inbound");
 
  257                    "ripple::PeerFinder::Counts::adjust : input is not " 
  282                    "ripple::PeerFinder::Counts::adjust : invalid input state");
 
 
 
Manages the count of available connections for the various slots.
 
std::size_t m_out_active
Active outbound slots.
 
std::size_t fixed_active() const
Returns the number of active fixed connections.
 
std::string state_string() const
Records the state for diagnostics.
 
int outboundSlotsFree() const
Returns the number of unused outbound slots.
 
int closingCount() const
Returns the number of connections that are gracefully closing.
 
int acceptCount() const
Returns the number of accepted connections that haven't handshaked.
 
std::size_t fixed() const
Returns the number of fixed connections.
 
bool isConnectedToNetwork() const
Returns true if the slot logic considers us "connected" to the network.
 
int out_active() const
Returns the number of outbound peers assigned an open slot.
 
int inboundActive() const
Returns the number of inbound peers assigned an open slot.
 
std::size_t m_reserved
Reserved connections.
 
std::size_t attempts_needed() const
Returns the number of attempts needed to bring us to the max.
 
int m_attempts
Outbound connection attempts.
 
void onWrite(beast::PropertyStream::Map &map)
Output statistics.
 
std::size_t m_in_active
Number of inbound slots assigned to active peers.
 
int out_max() const
Returns the total number of outbound slots.
 
std::size_t m_fixed_active
Active fixed connections.
 
void add(Slot const &s)
Adds the slot state and properties to the slot counts.
 
int inboundSlotsFree() const
Returns the number of unused inbound slots.
 
int in_max() const
Returns the total number of inbound slots.
 
int connectCount() const
Returns the number of connection attempts currently active.
 
int totalActive() const
Returns the total number of active peers excluding fixed peers.
 
std::size_t m_fixed
Fixed connections.
 
void adjust(Slot const &s, int const n)
 
void remove(Slot const &s)
Removes the slot state and properties from the slot counts.
 
std::size_t m_active
Active connections, including fixed and reserved.
 
void onConfig(Config const &config)
Called when the config is set or changed.
 
std::size_t m_in_max
Total number of inbound slots.
 
std::size_t m_out_max
Maximum desired outbound slots.
 
bool can_activate(Slot const &s) const
Returns true if the slot can become active.
 
std::size_t attempts() const
Returns the number of outbound connection attempts.
 
Properties and state associated with a peer to peer overlay connection.
 
virtual bool inbound() const =0
Returns true if this is an inbound connection.
 
virtual bool fixed() const =0
Returns true if this is a fixed connection.
 
virtual State state() const =0
Returns the state of the connection.
 
virtual bool reserved() const =0
Returns true if this is a reserved connection.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
PeerFinder configuration settings.
 
std::size_t inPeers
The number of automatic inbound connections to maintain.
 
bool wantIncoming
true if we want to accept incoming connections.
 
std::size_t outPeers
The number of automatic outbound connections to maintain.