X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Ftrustlistrequester.cpp;h=3fd5d991bb88cd77dda7a533a1c5d55f88afe20a;hb=b9c3763a932cebaa015a27fe111017f6f34dfbaa;hp=5b13a6d1ce8a3537fe50cab2ed90da111678a1e5;hpb=9048d8e482c91960265f29c2b5b3112f2a52f3d8;p=fms.git diff --git a/src/freenet/trustlistrequester.cpp b/src/freenet/trustlistrequester.cpp index 5b13a6d..3fd5d99 100644 --- a/src/freenet/trustlistrequester.cpp +++ b/src/freenet/trustlistrequester.cpp @@ -112,7 +112,7 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed TrustList XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListRequester::HandleAllData parsed TrustList XML file : "+message["Identifier"]); } else { @@ -124,7 +124,7 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing TrustList XML file : "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListRequester::HandleAllData error parsing TrustList XML file : "+message["Identifier"]); } // remove this identityid from request list @@ -157,7 +157,7 @@ const bool TrustListRequester::HandleGetFailed(FCPMessage &message) st.Step(); st.Finalize(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListRequester::HandleGetFailed fatal error requesting "+message["Identifier"]); } // remove this identityid from request list @@ -205,7 +205,7 @@ const bool TrustListRequester::HandleMessage(FCPMessage &message) void TrustListRequester::Initialize() { std::string tempval=""; - Option::instance()->Get("MaxIdentityRequests",tempval); + Option::Instance()->Get("MaxIdentityRequests",tempval); StringFunctions::Convert(tempval,m_maxrequests); if(m_maxrequests<1) { @@ -216,7 +216,7 @@ void TrustListRequester::Initialize() { m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"Option MaxTrustListRequests is currently set at "+tempval+". This value might be incorrectly configured."); } - Option::instance()->Get("MessageBase",m_messagebase); + Option::Instance()->Get("MessageBase",m_messagebase); m_tempdate.SetToGMTime(); } @@ -224,11 +224,16 @@ void TrustListRequester::PopulateIDList() { DateTime date; int id; + std::string sql; date.SetToGMTime(); // select identities we want to query (we've seen them today and they are publishing trust list) - sort by their trust level (descending) with secondary sort on how long ago we saw them (ascending) - SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+date.Format("%Y-%m-%d")+"' AND PublishTrustList='true' AND LocalTrustListTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalTrustListTrust') ORDER BY LocalMessageTrust+LocalTrustListTrust DESC, LastSeen;"); + sql="SELECT IdentityID FROM tblIdentity "; + sql+="WHERE Name IS NOT NULL AND Name <> '' AND PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+date.Format("%Y-%m-%d")+"' AND PublishTrustList='true' AND LocalTrustListTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalTrustListTrust') AND ( PeerTrustListTrust IS NULL OR PeerTrustListTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerTrustListTrust') )"; + sql+="ORDER BY LocalTrustListTrust DESC, LastSeen;"; + + SQLite3DB::Statement st=m_db->Prepare(sql); st.Step(); m_ids.clear(); @@ -269,7 +274,7 @@ void TrustListRequester::Process() // this will recheck for ids every minute DateTime now; now.SetToGMTime(); - if(m_tempdate<(now-(1.0/1440.0))) + if(m_ids.size()==0 && m_tempdate<(now-(1.0/1440.0))) { PopulateIDList(); m_tempdate=now;