mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Make sure we maintain cluster connections.
This commit is contained in:
@@ -209,6 +209,12 @@ void ConnectionPool::policyEnforce()
|
||||
// Enforce policies.
|
||||
policyLowWater();
|
||||
|
||||
if (((++mPhase) % 12) == 0)
|
||||
{
|
||||
cLog(lsTRACE) << "Making configured connections";
|
||||
makeConfigured();
|
||||
}
|
||||
|
||||
// Schedule next enforcement.
|
||||
mPolicyTimer.expires_at(boost::posix_time::second_clock::universal_time()+boost::posix_time::seconds(POLICY_INTERVAL_SECONDS));
|
||||
mPolicyTimer.async_wait(boost::bind(&ConnectionPool::policyHandler, this, _1));
|
||||
@@ -313,11 +319,11 @@ Peer::pointer ConnectionPool::peerConnect(const std::string& strIp, int iPort)
|
||||
if (ppResult)
|
||||
{
|
||||
ppResult->connect(strIp, iPort);
|
||||
//cLog(lsINFO) << "Pool: Connecting: " << ADDRESS_SHARED(ppResult) << ": " << strIp << " " << iPort;
|
||||
cLog(lsTRACE) << "Pool: Connecting: " << ADDRESS_SHARED(ppResult) << ": " << strIp << " " << iPort;
|
||||
}
|
||||
else
|
||||
{
|
||||
//cLog(lsINFO) << "Pool: Already connected: " << strIp << " " << iPort;
|
||||
cLog(lsTRACE) << "Pool: Already connected: " << strIp << " " << iPort;
|
||||
}
|
||||
|
||||
return ppResult;
|
||||
@@ -623,6 +629,20 @@ void ConnectionPool::scanHandler(const boost::system::error_code& ecResult)
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionPool::makeConfigured()
|
||||
{
|
||||
if (theConfig.RUN_STANDALONE)
|
||||
return;
|
||||
|
||||
BOOST_FOREACH(const std::string& strPeer, theConfig.IPS)
|
||||
{
|
||||
std::string strIP;
|
||||
int iPort;
|
||||
if (parseIpPort(strPeer, strIP, iPort))
|
||||
peerConnect(strIP, iPort);
|
||||
}
|
||||
}
|
||||
|
||||
// Scan ips as per db entries.
|
||||
void ConnectionPool::scanRefresh()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user