X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Ffreenet%2Ffreenetmasterthread.cpp;h=57541a4207914da5c12a911bb6baebd9516a17ce;hp=48903394d53ff496b326c18b40f01667c5d961a8;hb=HEAD;hpb=4e96d123460d6363cf7274e36bd9357768eb86ad diff --git a/src/freenet/freenetmasterthread.cpp b/src/freenet/freenetmasterthread.cpp index 4890339..57541a4 100644 --- a/src/freenet/freenetmasterthread.cpp +++ b/src/freenet/freenetmasterthread.cpp @@ -21,6 +21,9 @@ #include "../../include/freenet/siteinserter.h" #include "../../include/freenet/fileinserter.h" #include "../../include/freenet/fmsversionrequester.h" +#ifdef FROST_SUPPORT + #include "../../include/freenet/frostmessagerequester.h" +#endif #include #include @@ -34,30 +37,9 @@ #include #endif -FreenetMasterThread::FreenetMasterThread() +FreenetMasterThread::FreenetMasterThread():m_receivednodehello(false) { - if(Option::Instance()->Get("FCPHost",m_fcphost)==false) - { - m_fcphost="localhost"; - Option::Instance()->Set("FCPHost",m_fcphost); - } - if(Option::Instance()->GetInt("FCPPort",m_fcpport)==false) - { - m_fcpport=9481; - Option::Instance()->Set("FCPPort",m_fcpport); - } - else - { - if(m_fcpport<1 || m_fcpport>65535) - { - m_fcpport=9481; - Option::Instance()->Set("FCPPort",m_fcpport); - } - } - - m_receivednodehello=false; - } FreenetMasterThread::~FreenetMasterThread() @@ -195,6 +177,10 @@ void FreenetMasterThread::run() m_log->debug("FreenetMasterThread::run thread started."); + LoadDatabase(); + + + Setup(); do @@ -288,29 +274,58 @@ void FreenetMasterThread::run() void FreenetMasterThread::Setup() { + std::string temp=""; + Option option(m_db); + if(option.Get("FCPHost",m_fcphost)==false) + { + m_fcphost="localhost"; + option.Set("FCPHost",m_fcphost); + } + if(option.GetInt("FCPPort",m_fcpport)==false) + { + m_fcpport=9481; + option.Set("FCPPort",m_fcpport); + } + else + { + if(m_fcpport<1 || m_fcpport>65535) + { + m_fcpport=9481; + option.Set("FCPPort",m_fcpport); + } + } + // seed random number generator srand(time(NULL)); - m_registrables.push_back(new UnkeyedIDCreator(&m_fcp)); - m_registrables.push_back(new IdentityInserter(&m_fcp)); - m_registrables.push_back(new IdentityRequester(&m_fcp)); - m_registrables.push_back(new UnknownIdentityRequester(&m_fcp)); - m_registrables.push_back(new IntroductionPuzzleInserter(&m_fcp)); - m_registrables.push_back(new IdentityIntroductionRequester(&m_fcp)); - m_registrables.push_back(new IntroductionPuzzleRequester(&m_fcp)); - 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 InactiveMessageListRequester(&m_fcp)); - m_registrables.push_back(new MessageInserter(&m_fcp)); - m_registrables.push_back(new MessageRequester(&m_fcp)); - m_registrables.push_back(new BoardListInserter(&m_fcp)); - m_registrables.push_back(new BoardListRequester(&m_fcp)); - m_registrables.push_back(new SiteInserter(&m_fcp)); - m_registrables.push_back(new FileInserter(&m_fcp)); - m_registrables.push_back(new FMSVersionRequester(&m_fcp)); + m_registrables.push_back(new UnkeyedIDCreator(m_db,&m_fcp)); + m_registrables.push_back(new IdentityInserter(m_db,&m_fcp)); + m_registrables.push_back(new IdentityRequester(m_db,&m_fcp)); + m_registrables.push_back(new UnknownIdentityRequester(m_db,&m_fcp)); + m_registrables.push_back(new IntroductionPuzzleInserter(m_db,&m_fcp)); + m_registrables.push_back(new IdentityIntroductionRequester(m_db,&m_fcp)); + m_registrables.push_back(new IntroductionPuzzleRequester(m_db,&m_fcp)); + m_registrables.push_back(new IdentityIntroductionInserter(m_db,&m_fcp)); + m_registrables.push_back(new TrustListInserter(m_db,&m_fcp)); + m_registrables.push_back(new TrustListRequester(m_db,&m_fcp)); + m_registrables.push_back(new MessageListInserter(m_db,&m_fcp)); + m_registrables.push_back(new MessageListRequester(m_db,&m_fcp)); + m_registrables.push_back(new InactiveMessageListRequester(m_db,&m_fcp)); + m_registrables.push_back(new MessageInserter(m_db,&m_fcp)); + m_registrables.push_back(new MessageRequester(m_db,&m_fcp)); + m_registrables.push_back(new BoardListInserter(m_db,&m_fcp)); + m_registrables.push_back(new BoardListRequester(m_db,&m_fcp)); + m_registrables.push_back(new SiteInserter(m_db,&m_fcp)); + m_registrables.push_back(new FileInserter(m_db,&m_fcp)); + m_registrables.push_back(new FMSVersionRequester(m_db,&m_fcp)); +#ifdef FROST_SUPPORT + temp=""; + option.Get("DownloadFrostMessages",temp); + if(temp=="true") + { + m_registrables.push_back(new FrostMessageRequester(m_db,&m_fcp)); + } +#endif for(std::vector::iterator i=m_registrables.begin(); i!=m_registrables.end(); i++) {