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