X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Ffreenet%2Ffreenetmasterthread.cpp;h=f30cbf1259f9e354a9fc2b1d2cd4c3fbb883f678;hp=a9f23917e2d5fef17445a105d8b535d2cba81205;hb=df316253862dc50e8e5a790d9634ef90be37badb;hpb=f60495a029c54358f82956482fe203fe2b7b5b23 diff --git a/src/freenet/freenetmasterthread.cpp b/src/freenet/freenetmasterthread.cpp index a9f2391..f30cbf1 100644 --- a/src/freenet/freenetmasterthread.cpp +++ b/src/freenet/freenetmasterthread.cpp @@ -16,6 +16,8 @@ #include "../../include/freenet/messageinserter.h" #include "../../include/freenet/messagelistinserter.h" #include "../../include/freenet/periodicdbmaintenance.h" +#include "../../include/freenet/boardlistinserter.h" +#include "../../include/freenet/boardlistrequester.h" //#include #include "../../include/pthreadwrapper/thread.h" @@ -167,6 +169,8 @@ void FreenetMasterThread::RegisterPeriodicProcessor(IPeriodicProcessor *obj) void FreenetMasterThread::Run() { + DateTime lastreceivedmessage; + DateTime now; FCPMessage message; bool done=false; @@ -199,6 +203,10 @@ void FreenetMasterThread::Run() Sleep(1000); } } + else + { + lastreceivedmessage.SetToGMTime(); + } } // fcp is connected else @@ -214,6 +222,7 @@ void FreenetMasterThread::Run() if(message.GetName()!="") { HandleMessage(message); + lastreceivedmessage.SetToGMTime(); } } @@ -223,6 +232,14 @@ void FreenetMasterThread::Run() (*i)->Process(); } + // if we haven't received any messages from the node in 10 minutes, something is wrong + now.SetToGMTime(); + if(lastreceivedmessage<(now-(1.0/144.0))) + { + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::Run The Freenet node has not responded in 10 minutes. Trying to reconnect."); + m_fcp.Disconnect(); + } + } // }while(!ZThread::Thread::interrupted() && done==false); }while(!IsCancelled() && done==false); @@ -250,10 +267,12 @@ void FreenetMasterThread::Setup() m_registrables.push_back(new IdentityIntroductionInserter(&m_fcp)); m_registrables.push_back(new TrustListInserter(&m_fcp)); m_registrables.push_back(new TrustListRequester(&m_fcp)); + m_registrables.push_back(new MessageListInserter(&m_fcp)); m_registrables.push_back(new MessageListRequester(&m_fcp)); m_registrables.push_back(new MessageRequester(&m_fcp)); m_registrables.push_back(new MessageInserter(&m_fcp)); - m_registrables.push_back(new MessageListInserter(&m_fcp)); + m_registrables.push_back(new BoardListInserter(&m_fcp)); + m_registrables.push_back(new BoardListRequester(&m_fcp)); m_registrables.push_back(new PeriodicDBMaintenance()); for(std::vector::iterator i=m_registrables.begin(); i!=m_registrables.end(); i++)