more work on your peer list

This commit is contained in:
jed
2012-06-13 09:57:08 -07:00
parent 089541d630
commit e6464e2832
6 changed files with 29 additions and 22 deletions

View File

@@ -61,7 +61,7 @@ bool ConnectionPool::getTopNAddrs(int n,std::vector<std::string>& addrs)
return true;
}
bool ConnectionPool::savePeer(const std::string& strIp, int iPort)
bool ConnectionPool::savePeer(const std::string& strIp, int iPort,char code)
{
Database* db = theApp->getWalletDB()->getDB();
@@ -73,7 +73,7 @@ bool ConnectionPool::savePeer(const std::string& strIp, int iPort)
{
if( db->getInt(0)==0)
{
db->executeSQL(str(boost::format("INSERT INTO PeerIps (IpPort,Score,Source) values (%s,0,'a');") % ipPort));
db->executeSQL(str(boost::format("INSERT INTO PeerIps (IpPort,Score,Source) values (%s,0,'%c');") % ipPort % code));
return true;
}// else we already had this peer
}else std::cout << "Error saving Peer" << std::endl;
@@ -285,8 +285,6 @@ bool ConnectionPool::peerConnected(Peer::pointer peer, const NewcoinAddress& na)
{
mConnectedMap[na] = peer;
bSuccess = true;
savePeer(peer->getIP(),peer->getPort());
}