X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=include%2Ffreenet%2Fiindexinserter.h;h=ba5c9888bee0d687ec92cafdab0ec7c61c44fda1;hb=221236a4d3aac4144529d418ce368db5c98facb0;hp=edcc86bd2e70cf1de200b50de69ff43d68f2181f;hpb=6836fbb5db8464f56e682989996b2210b14231d0;p=fms.git diff --git a/include/freenet/iindexinserter.h b/include/freenet/iindexinserter.h index edcc86b..ba5c988 100644 --- a/include/freenet/iindexinserter.h +++ b/include/freenet/iindexinserter.h @@ -4,13 +4,16 @@ #include "../idatabase.h" #include "../ilogger.h" #include "../option.h" -#include "../datetime.h" #include "../stringfunctions.h" #include "ifreenetregistrable.h" #include "ifcpconnected.h" #include "ifcpmessagehandler.h" #include "iperiodicprocessor.h" +#include +#include +#include + #ifdef XMEM #include #endif @@ -42,7 +45,7 @@ protected: std::vector m_inserting; // list of ids we are inserting std::string m_messagebase; - DateTime m_lastchecked; + Poco::DateTime m_lastchecked; // these MUST be populated by child class std::string m_fcpuniquename; @@ -66,11 +69,11 @@ void IIndexInserter::FCPConnected() // make sure variables have been initialized by the derived class if(m_fcpuniquename=="") { - m_log->WriteLog(LogFile::LOGLEVEL_FATAL,"IIndexInserter::FCPConnected fcpuniquename not initialized correctly!"); + m_log->fatal("IIndexInserter::FCPConnected fcpuniquename not initialized correctly!"); } if(m_fcpuniquename.find("|")!=std::string::npos) { - m_log->WriteLog(LogFile::LOGLEVEL_FATAL,"IIndexInserter::FCPConnected fcpuniquename contains | character! This is not a valid character!"); + m_log->fatal("IIndexInserter::FCPConnected fcpuniquename : "+m_fcpuniquename+" contains | character! This is not a valid character!"); } m_inserting.clear(); @@ -88,6 +91,8 @@ const bool IIndexInserter::HandleMessage(FCPMessage &message) if(message["Identifier"].find(m_fcpuniquename)==0) { + m_log->trace("IIndexInserter::HandleMessage "+m_fcpuniquename+" received "+message.GetName()+" ID="+message["Identifier"]+" URI="+message["URI"]); + if(message.GetName()=="URIGenerated") { return true; @@ -111,7 +116,7 @@ const bool IIndexInserter::HandleMessage(FCPMessage &message) StringFunctions::Split(message["Identifier"],"|",idparts); StringFunctions::Convert(idparts[1],id); RemoveFromInsertList(id); - m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IIndexInserter::HandleMessage IdentifierCollision for "+m_fcpuniquename+" "+message["Identifier"]); + m_log->debug("IIndexInserter::HandleMessage IdentifierCollision for "+m_fcpuniquename+" "+message["Identifier"]); return true; } } @@ -124,16 +129,15 @@ void IIndexInserter::InitializeIIndexInserter() { m_fcpuniquename=""; Option::Instance()->Get("MessageBase",m_messagebase); - m_lastchecked.SetToGMTime(); + m_lastchecked=Poco::Timestamp(); } template void IIndexInserter::Process() { - DateTime now; - now.SetToGMTime(); + Poco::DateTime now; - if(m_lastchecked<(now-(1.0/1440.0))) + if(m_lastchecked<(now-Poco::Timespan(0,0,1,0,0))) { CheckForNeededInsert(); m_lastchecked=now;