mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
#include <vector>
|
||||
#include "../src/types.h"
|
||||
|
||||
#define SQL_FOREACH(_db, _strQuery) \
|
||||
if ((_db)->executeSQL(_strQuery)) \
|
||||
for (bool _bMore = (_db)->startIterRows(); _bMore; _bMore = (_db)->getNextRow())
|
||||
|
||||
/*
|
||||
this maintains the connection to the database
|
||||
*/
|
||||
@@ -76,6 +80,6 @@ public:
|
||||
// char* getSingleDBValueStr(const char* sql, std::string& retStr);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#define SQL_FOREACH(_db, _strQuery) \
|
||||
if ((_db)->executeSQL(_strQuery)) \
|
||||
for (bool _bMore = (db)->startIterRows(); _bMore; _bMore = (_db)->getNextRow())
|
||||
|
||||
void splitIpPort(const std::string& strIpPort, std::string& strIp, int& iPort)
|
||||
{
|
||||
std::vector<std::string> vIpPort;
|
||||
@@ -252,16 +248,12 @@ bool ConnectionPool::connectTo(const std::string& strIp, int iPort)
|
||||
|
||||
Json::Value ConnectionPool::getPeersJson()
|
||||
{
|
||||
Json::Value ret(Json::arrayValue);
|
||||
Json::Value ret(Json::arrayValue);
|
||||
std::vector<Peer::pointer> vppPeers = getPeerVector();
|
||||
|
||||
boost::mutex::scoped_lock sl(mPeerLock);
|
||||
|
||||
BOOST_FOREACH(naPeer pair, mConnectedMap)
|
||||
BOOST_FOREACH(Peer::pointer peer, vppPeers)
|
||||
{
|
||||
Peer::pointer peer = pair.second;
|
||||
if (!peer)
|
||||
std::cerr << "CP::GPH null peer" << std::endl;
|
||||
else ret.append(peer->getJson());
|
||||
ret.append(peer->getJson());
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -289,7 +281,9 @@ bool ConnectionPool::peerConnected(Peer::pointer peer, const NewcoinAddress& na)
|
||||
{
|
||||
bool bSuccess;
|
||||
|
||||
std::cerr << "ConnectionPool::peerConnected: " << na.humanNodePublic() << std::endl;
|
||||
std::cerr << "ConnectionPool::peerConnected: " << na.humanNodePublic()
|
||||
<< " " << peer->getIP() << " " << peer->getPort()
|
||||
<< std::endl;
|
||||
assert(!!peer);
|
||||
if (na == theApp->getWallet().getNodePublic())
|
||||
{
|
||||
|
||||
@@ -535,10 +535,6 @@ void NetworkOPs::setMode(OperatingMode om)
|
||||
mMode = om;
|
||||
}
|
||||
|
||||
#define SQL_FOREACH(_db, _strQuery) \
|
||||
if ((_db)->executeSQL(_strQuery)) \
|
||||
for (bool _bMore = (db)->startIterRows(); _bMore; _bMore = (_db)->getNextRow())
|
||||
|
||||
std::vector< std::pair<uint32, uint256> >
|
||||
NetworkOPs::getAffectedAccounts(const NewcoinAddress& account, uint32 minLedger, uint32 maxLedger)
|
||||
{
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
enum PeerPunish
|
||||
{
|
||||
PP_INVALID_REQUEST = 1, // The peer sent a request that makes no sense
|
||||
PP_UNKNOWN_REQUEST = 2, // The peer sent a request that might be garbage
|
||||
PP_UNWANTED_DATA = 3, // The peer sent us data we didn't want/need
|
||||
PP_INVALID_REQUEST = 1, // The peer sent a request that makes no sense
|
||||
PP_UNKNOWN_REQUEST = 2, // The peer sent a request that might be garbage
|
||||
PP_UNWANTED_DATA = 3, // The peer sent us data we didn't want/need
|
||||
};
|
||||
|
||||
typedef std::pair<std::string,int> ipPort;
|
||||
@@ -56,10 +56,7 @@ protected:
|
||||
|
||||
Peer(boost::asio::io_service& io_service, boost::asio::ssl::context& ctx);
|
||||
|
||||
|
||||
|
||||
void handle_write(const boost::system::error_code& error, size_t bytes_transferred);
|
||||
//void handle_read(const boost::system::error_code& error, size_t bytes_transferred);
|
||||
void handle_read_header(const boost::system::error_code& error);
|
||||
void handle_read_body(const boost::system::error_code& error);
|
||||
void processReadBuffer();
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
#define REFERRAL_VALIDATORS_MAX 50
|
||||
#define REFERRAL_IPS_MAX 50
|
||||
|
||||
#define SQL_FOREACH(_db, _strQuery) \
|
||||
if ((_db)->executeSQL(_strQuery)) \
|
||||
for (bool _bMore = (db)->startIterRows(); _bMore; _bMore = (_db)->getNextRow())
|
||||
|
||||
UniqueNodeList::UniqueNodeList(boost::asio::io_service& io_service) :
|
||||
mdtScoreTimer(io_service),
|
||||
mFetchActive(0),
|
||||
@@ -452,9 +448,10 @@ void UniqueNodeList::scoreCompute()
|
||||
std::string strIpPort = str(boost::format("%s %d") % ipEndpoint.first % ipEndpoint.second);
|
||||
score iPoints = ipScore.second;
|
||||
|
||||
vstrValues.push_back(str(boost::format("(%s,%d,'V')")
|
||||
vstrValues.push_back(str(boost::format("(%s,%d,'%c')")
|
||||
% db->escape(strIpPort)
|
||||
% iPoints));
|
||||
% iPoints
|
||||
% vsValidator));
|
||||
}
|
||||
|
||||
// Set scores for each IP.
|
||||
|
||||
Reference in New Issue
Block a user