mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 18:45:55 +00:00
Cosmetic changes.
This commit is contained in:
@@ -40,5 +40,6 @@ public:
|
|||||||
uint64 getBigInt(int colIndex);
|
uint64 getBigInt(int colIndex);
|
||||||
|
|
||||||
void escape(const unsigned char* start,int size,std::string& retStr);
|
void escape(const unsigned char* start,int size,std::string& retStr);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -81,26 +81,27 @@ bool ConnectionPool::savePeer(const std::string& strIp, int iPort,char code)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// <-- true, if a peer is available to connect to
|
||||||
bool ConnectionPool::peerAvailable(std::string& strIp, int& iPort)
|
bool ConnectionPool::peerAvailable(std::string& strIp, int& iPort)
|
||||||
{
|
{
|
||||||
Database* db = theApp->getWalletDB()->getDB();
|
Database* db = theApp->getWalletDB()->getDB();
|
||||||
std::vector<std::string> vstrIpPort;
|
std::vector<std::string> vstrIpPort;
|
||||||
|
|
||||||
|
// Convert mIpMap (list of open connections) to a vector of "<ip> <port>".
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock sl(mPeerLock);
|
boost::mutex::scoped_lock sl(mPeerLock);
|
||||||
pipPeer ipPeer;
|
|
||||||
|
|
||||||
vstrIpPort.reserve(mIpMap.size());
|
vstrIpPort.reserve(mIpMap.size());
|
||||||
|
|
||||||
BOOST_FOREACH(ipPeer, mIpMap)
|
BOOST_FOREACH(pipPeer ipPeer, mIpMap)
|
||||||
{
|
{
|
||||||
std::string& strIp = ipPeer.first.first;
|
const std::string& strIp = ipPeer.first.first;
|
||||||
int iPort = ipPeer.first.second;
|
int iPort = ipPeer.first.second;
|
||||||
|
|
||||||
vstrIpPort.push_back(db->escape(str(boost::format("%s %d") % strIp % iPort)));
|
vstrIpPort.push_back(db->escape(str(boost::format("%s %d") % strIp % iPort)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the first IpPort entry which is not in vector and which is not scheduled for scanning.
|
||||||
std::string strIpPort;
|
std::string strIpPort;
|
||||||
|
|
||||||
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
||||||
|
|||||||
Reference in New Issue
Block a user