X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Funkeyedidcreator.cpp;h=53f6c0eeea1628f7cf85601912ec44063009b099;hb=59a5414ec47a2932a7802fcd1d98c4d80166564f;hp=df46469db25788b1760f889a202c080623eb8569;hpb=d8f51eac91f86a1e00a05a5058a8fa9eb8732464;p=fms.git diff --git a/src/freenet/unkeyedidcreator.cpp b/src/freenet/unkeyedidcreator.cpp index df46469..53f6c0e 100644 --- a/src/freenet/unkeyedidcreator.cpp +++ b/src/freenet/unkeyedidcreator.cpp @@ -1,18 +1,20 @@ #include "../../include/freenet/unkeyedidcreator.h" #include "../../include/stringfunctions.h" +#include + #include #ifdef XMEM #include #endif -UnkeyedIDCreator::UnkeyedIDCreator() +UnkeyedIDCreator::UnkeyedIDCreator(SQLite3DB::DB *db):IDatabase(db) { Initialize(); } -UnkeyedIDCreator::UnkeyedIDCreator(FCPv2 *fcp):IFCPConnected(fcp) +UnkeyedIDCreator::UnkeyedIDCreator(SQLite3DB::DB *db, FCPv2::Connection *fcp):IDatabase(db),IFCPConnected(fcp) { Initialize(); } @@ -40,21 +42,21 @@ void UnkeyedIDCreator::CheckForUnkeyedID() long id=rs.GetInt(0); idstr << id; - FCPMessage message; + FCPv2::Message message; message.SetName("GenerateSSK"); message["Identifier"]="UnkeyedIDRequest|"+idstr.str(); - m_fcp->SendMessage(message); + m_fcp->Send(message); m_waiting=true; } // set last checked time to now - m_lastchecked.SetToGMTime(); + m_lastchecked=Poco::Timestamp(); } -const bool UnkeyedIDCreator::HandleMessage(FCPMessage &message) +const bool UnkeyedIDCreator::HandleMessage(FCPv2::Message &message) { if(message["Identifier"].find("UnkeyedIDRequest")==0) { @@ -75,7 +77,7 @@ const bool UnkeyedIDCreator::HandleMessage(FCPMessage &message) SaveKeys(id,message["RequestURI"],message["InsertURI"]); } - m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" received keypair"); + m_log->information("UnkeyedIDCreator::HandleMessage received keypair"); m_waiting=false; @@ -90,16 +92,15 @@ const bool UnkeyedIDCreator::HandleMessage(FCPMessage &message) void UnkeyedIDCreator::Initialize() { m_waiting=false; - m_lastchecked.SetToGMTime(); + m_lastchecked=Poco::Timestamp(); } void UnkeyedIDCreator::Process() { - DateTime now; - now.SetToGMTime(); + Poco::DateTime now; // only perform check every minute (1/1440 of 1 day) - if(m_waiting==false && m_lastchecked<(now-(1.0/1440.0))) + if(m_waiting==false && m_lastchecked<(now-Poco::Timespan(0,0,1,0,0))) { CheckForUnkeyedID(); }