mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Set PEERS_MAX default value
This commit is contained in:
@@ -43,6 +43,11 @@ struct Config
|
||||
|
||||
/** Write the configuration into a property stream */
|
||||
void onWrite(PropertyStream::Map& map);
|
||||
|
||||
/** Called to set sensible default values for anything
|
||||
that hasn't been initialized.
|
||||
*/
|
||||
void fillInDefaultValues();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace ripple {
|
||||
namespace PeerFinder {
|
||||
|
||||
Config::Config ()
|
||||
: maxPeerCount (20)
|
||||
: maxPeerCount (0)
|
||||
, wantIncoming (false)
|
||||
, connectAutomatically (false)
|
||||
, listeningPort (0)
|
||||
@@ -39,5 +39,11 @@ void Config::onWrite(PropertyStream::Map &map)
|
||||
map ["feature_list"] = featureList;
|
||||
}
|
||||
|
||||
void Config::fillInDefaultValues()
|
||||
{
|
||||
if (maxPeerCount == 0)
|
||||
maxPeerCount = defaultMaxPeerCount;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +119,8 @@ public:
|
||||
, m_cache (journal)
|
||||
, m_legacyCache (store, journal)
|
||||
{
|
||||
/* assign sensible default values */
|
||||
m_config.fillInDefaultValues();
|
||||
}
|
||||
|
||||
DiscreteTime get_now()
|
||||
@@ -243,6 +245,10 @@ public:
|
||||
void setConfig (Config const& config)
|
||||
{
|
||||
m_config = config;
|
||||
|
||||
/* give sensible defaults to any uninitialized fields */
|
||||
m_config.fillInDefaultValues();
|
||||
|
||||
m_slots.update (m_config);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,10 @@ enum
|
||||
// away than this are dropped.
|
||||
,maxPeerHopCount = 10
|
||||
|
||||
// The number of peers that we want by default, unless an
|
||||
// explicit value is set in the config file.
|
||||
,defaultMaxPeerCount = 20
|
||||
|
||||
//---------------------------------------------------------
|
||||
//
|
||||
// LegacyEndpoint Settings
|
||||
|
||||
@@ -78,7 +78,7 @@ Config::Config ()
|
||||
PEER_CONNECT_LOW_WATER = DEFAULT_PEER_CONNECT_LOW_WATER;
|
||||
|
||||
PEER_PRIVATE = false;
|
||||
PEERS_MAX = DEFAULT_PEERS_MAX;
|
||||
PEERS_MAX = 0; // indicates "use default"
|
||||
|
||||
TRANSACTION_FEE_BASE = DEFAULT_FEE_DEFAULT;
|
||||
|
||||
@@ -314,7 +314,7 @@ void Config::load ()
|
||||
PEER_PRIVATE = lexicalCastThrow <bool> (strTemp);
|
||||
|
||||
if (SectionSingleB (secConfig, SECTION_PEERS_MAX, strTemp))
|
||||
PEERS_MAX = std::max (1, lexicalCastThrow <int> (strTemp));
|
||||
PEERS_MAX = lexicalCastThrow <int> (strTemp);
|
||||
|
||||
smtTmp = SectionEntries (secConfig, SECTION_RPC_ADMIN_ALLOW);
|
||||
|
||||
|
||||
@@ -53,9 +53,6 @@ const int SYSTEM_WEBSOCKET_PUBLIC_PORT = 6563; // XXX Going away.
|
||||
// Might connect with fewer for testing.
|
||||
#define DEFAULT_PEER_CONNECT_LOW_WATER 10
|
||||
|
||||
// The maximum number of peers to allow.
|
||||
#define DEFAULT_PEERS_MAX 100
|
||||
|
||||
#define DEFAULT_PATH_SEARCH_OLD 7
|
||||
#define DEFAULT_PATH_SEARCH 7
|
||||
#define DEFAULT_PATH_SEARCH_FAST 2
|
||||
|
||||
Reference in New Issue
Block a user