version 0.3.29
[fms.git] / src / freenet / freenetmasterthread.cpp
index 4890339..9c75a06 100644 (file)
        #include <xmem.h>\r
 #endif\r
 \r
-FreenetMasterThread::FreenetMasterThread()\r
+FreenetMasterThread::FreenetMasterThread():m_receivednodehello(false)\r
 {\r
 \r
-       if(Option::Instance()->Get("FCPHost",m_fcphost)==false)\r
-       {\r
-               m_fcphost="localhost";\r
-               Option::Instance()->Set("FCPHost",m_fcphost);\r
-       }\r
-       if(Option::Instance()->GetInt("FCPPort",m_fcpport)==false)\r
-       {\r
-               m_fcpport=9481;\r
-               Option::Instance()->Set("FCPPort",m_fcpport);\r
-       }\r
-       else\r
-       {\r
-               if(m_fcpport<1 || m_fcpport>65535)\r
-               {\r
-                       m_fcpport=9481;\r
-                       Option::Instance()->Set("FCPPort",m_fcpport);\r
-               }\r
-       }\r
-\r
-       m_receivednodehello=false;\r
-\r
 }\r
 \r
 FreenetMasterThread::~FreenetMasterThread()\r
@@ -195,6 +174,10 @@ void FreenetMasterThread::run()
 \r
        m_log->debug("FreenetMasterThread::run thread started.");\r
 \r
+       LoadDatabase();\r
+\r
+\r
+\r
        Setup();\r
 \r
        do\r
@@ -288,29 +271,49 @@ void FreenetMasterThread::run()
 void FreenetMasterThread::Setup()\r
 {\r
 \r
+       Option option(m_db);\r
+       if(option.Get("FCPHost",m_fcphost)==false)\r
+       {\r
+               m_fcphost="localhost";\r
+               option.Set("FCPHost",m_fcphost);\r
+       }\r
+       if(option.GetInt("FCPPort",m_fcpport)==false)\r
+       {\r
+               m_fcpport=9481;\r
+               option.Set("FCPPort",m_fcpport);\r
+       }\r
+       else\r
+       {\r
+               if(m_fcpport<1 || m_fcpport>65535)\r
+               {\r
+                       m_fcpport=9481;\r
+                       option.Set("FCPPort",m_fcpport);\r
+               }\r
+       }\r
+\r
        // seed random number generator\r
        srand(time(NULL));\r
 \r
-       m_registrables.push_back(new UnkeyedIDCreator(&m_fcp));\r
-       m_registrables.push_back(new IdentityInserter(&m_fcp));\r
-       m_registrables.push_back(new IdentityRequester(&m_fcp));\r
-       m_registrables.push_back(new UnknownIdentityRequester(&m_fcp));\r
-       m_registrables.push_back(new IntroductionPuzzleInserter(&m_fcp));\r
-       m_registrables.push_back(new IdentityIntroductionRequester(&m_fcp));\r
-       m_registrables.push_back(new IntroductionPuzzleRequester(&m_fcp));\r
-       m_registrables.push_back(new IdentityIntroductionInserter(&m_fcp));\r
-       m_registrables.push_back(new TrustListInserter(&m_fcp));\r
-       m_registrables.push_back(new TrustListRequester(&m_fcp));\r
-       m_registrables.push_back(new MessageListInserter(&m_fcp));\r
-       m_registrables.push_back(new MessageListRequester(&m_fcp));\r
-       m_registrables.push_back(new InactiveMessageListRequester(&m_fcp));\r
-       m_registrables.push_back(new MessageInserter(&m_fcp));\r
-       m_registrables.push_back(new MessageRequester(&m_fcp));\r
-       m_registrables.push_back(new BoardListInserter(&m_fcp));\r
-       m_registrables.push_back(new BoardListRequester(&m_fcp));\r
-       m_registrables.push_back(new SiteInserter(&m_fcp));\r
-       m_registrables.push_back(new FileInserter(&m_fcp));\r
-       m_registrables.push_back(new FMSVersionRequester(&m_fcp));\r
+       m_registrables.push_back(new UnkeyedIDCreator(m_db,&m_fcp));\r
+       m_registrables.push_back(new IdentityInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new IdentityRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new UnknownIdentityRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new IntroductionPuzzleInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new IdentityIntroductionRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new IntroductionPuzzleRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new IdentityIntroductionInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new TrustListInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new TrustListRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new MessageListInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new MessageListRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new InactiveMessageListRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new MessageInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new MessageRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new BoardListInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new BoardListRequester(m_db,&m_fcp));\r
+       m_registrables.push_back(new SiteInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new FileInserter(m_db,&m_fcp));\r
+       m_registrables.push_back(new FMSVersionRequester(m_db,&m_fcp));\r
 \r
        for(std::vector<IFreenetRegistrable *>::iterator i=m_registrables.begin(); i!=m_registrables.end(); i++)\r
        {\r