#include <xmem.h>\r
#endif\r
\r
-TrustListRequester::TrustListRequester()\r
+TrustListRequester::TrustListRequester(SQLite3DB::DB *db):IIndexRequester<long>(db)\r
{\r
Initialize();\r
}\r
\r
-TrustListRequester::TrustListRequester(FCPv2::Connection *fcp):IIndexRequester<long>(fcp)\r
+TrustListRequester::TrustListRequester(SQLite3DB::DB *db, FCPv2::Connection *fcp):IIndexRequester<long>(db,fcp)\r
{\r
Initialize();\r
}\r
}\r
st.Finalize();\r
\r
+ m_db->Execute("BEGIN;");\r
+\r
// drop all existing peer trust from this identity - we will rebuild it when we go through each trust in the xml file\r
st=m_db->Prepare("DELETE FROM tblPeerTrust WHERE IdentityID=?;");\r
st.Bind(0,identityid);\r
st.Step();\r
st.Finalize();\r
\r
+ m_db->Execute("COMMIT;");\r
+\r
m_log->debug("TrustListRequester::HandleAllData parsed TrustList XML file : "+message["Identifier"]);\r
}\r
else\r
{\r
std::string tempval="";\r
m_fcpuniquename="TrustListRequester";\r
-\r
m_maxrequests=0;\r
- Option::Instance()->GetInt("MaxIdentityRequests",m_maxrequests);\r
+ Option option(m_db);\r
+\r
+ option.GetInt("MaxIdentityRequests",m_maxrequests);\r
if(m_maxrequests<1)\r
{\r
m_maxrequests=1;\r
\r
// 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)\r
sql="SELECT IdentityID FROM tblIdentity ";\r
- sql+="WHERE Name IS NOT NULL AND Name <> '' AND PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+Poco::DateTimeFormatter::format(date,"%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') )";\r
+ sql+="WHERE Name IS NOT NULL AND Name <> '' AND PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen>='"+Poco::DateTimeFormatter::format(date,"%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') ) AND tblIdentity.FailureCount<=(SELECT OptionValue FROM tblOption WHERE Option='MaxFailureCount')";\r
sql+="ORDER BY LocalTrustListTrust DESC, LastSeen;";\r
\r
SQLite3DB::Statement st=m_db->Prepare(sql);\r