X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Ffreenetmasterthread.cpp;h=398d8fa52990d1f64e04e81907aaa07d86c6517f;hb=c7fcb4c4bc5012a584add81a9509fc1f84c3c688;hp=689641fd8575d888e2a03ce5899a95998b269a37;hpb=964f55fd550fc711c0320ce6a24ad713040695d0;p=fms.git diff --git a/src/freenet/freenetmasterthread.cpp b/src/freenet/freenetmasterthread.cpp index 689641f..398d8fa 100644 --- a/src/freenet/freenetmasterthread.cpp +++ b/src/freenet/freenetmasterthread.cpp @@ -17,7 +17,8 @@ #include "../../include/freenet/messageinserter.h" #include "../../include/freenet/messagelistinserter.h" -#include +//#include +#include "../../include/pthreadwrapper/thread.h" #ifdef XMEM #include @@ -27,22 +28,22 @@ FreenetMasterThread::FreenetMasterThread() { std::string fcpport; - if(Option::instance()->Get("FCPHost",m_fcphost)==false) + if(Option::Instance()->Get("FCPHost",m_fcphost)==false) { m_fcphost="localhost"; - Option::instance()->Set("FCPHost",m_fcphost); + Option::Instance()->Set("FCPHost",m_fcphost); } - if(Option::instance()->Get("FCPPort",fcpport)==false) + if(Option::Instance()->Get("FCPPort",fcpport)==false) { fcpport="9481"; - Option::instance()->Set("FCPPort",fcpport); + Option::Instance()->Set("FCPPort",fcpport); } // convert fcp port to long, and make sure it's within the valid port range if(StringFunctions::Convert(fcpport,m_fcpport)==false) { m_fcpport=9481; - Option::instance()->Set("FCPPort","9481"); + Option::Instance()->Set("FCPPort","9481"); } m_receivednodehello=false; @@ -163,12 +164,14 @@ void FreenetMasterThread::RegisterPeriodicProcessor(IPeriodicProcessor *obj) m_processors.push_back(obj); } -void FreenetMasterThread::run() +void FreenetMasterThread::Run() { FCPMessage message; bool done=false; + m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"FreenetMasterThread::run thread started."); + Setup(); do @@ -181,6 +184,7 @@ void FreenetMasterThread::run() m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::run could not connect to node. Waiting 60 seconds."); // wait 60 seconds - will then try to connect again + /* try { ZThread::Thread::sleep(60000); @@ -189,6 +193,11 @@ void FreenetMasterThread::run() { done=true; } + */ + for(int i=0; i<60,!IsCancelled(); i++) + { + Sleep(1000); + } } } // fcp is connected @@ -215,7 +224,8 @@ void FreenetMasterThread::run() } } - }while(!ZThread::Thread::interrupted() && done==false); +// }while(!ZThread::Thread::interrupted() && done==false); + }while(!IsCancelled() && done==false); m_fcp.Disconnect();