#include "../../include/freenet/identityintroductioninserter.h"\r
#include "../../include/freenet/trustlistinserter.h"\r
#include "../../include/freenet/trustlistrequester.h"\r
+#include "../../include/freenet/messagelistrequester.h"\r
+#include "../../include/freenet/messagerequester.h"\r
+#include "../../include/freenet/messageinserter.h"\r
+#include "../../include/freenet/messagelistinserter.h"\r
\r
-#include <zthread/Thread.h>\r
+//#include <zthread/Thread.h>\r
+#include "../../include/pthreadwrapper/thread.h"\r
\r
#ifdef XMEM\r
#include <xmem.h>\r
{\r
std::string fcpport;\r
\r
- if(Option::instance()->Get("FCPHost",m_fcphost)==false)\r
+ if(Option::Instance()->Get("FCPHost",m_fcphost)==false)\r
{\r
m_fcphost="localhost";\r
- Option::instance()->Set("FCPHost",m_fcphost);\r
+ Option::Instance()->Set("FCPHost",m_fcphost);\r
}\r
- if(Option::instance()->Get("FCPPort",fcpport)==false)\r
+ if(Option::Instance()->Get("FCPPort",fcpport)==false)\r
{\r
fcpport="9481";\r
- Option::instance()->Set("FCPPort",fcpport);\r
+ Option::Instance()->Set("FCPPort",fcpport);\r
}\r
\r
// convert fcp port to long, and make sure it's within the valid port range\r
if(StringFunctions::Convert(fcpport,m_fcpport)==false)\r
{\r
m_fcpport=9481;\r
- Option::instance()->Set("FCPPort","9481");\r
+ Option::Instance()->Set("FCPPort","9481");\r
}\r
\r
m_receivednodehello=false;\r
m_receivednodehello=false;\r
}\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" trying to connect to node "+m_fcphost);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_INFO,"FreenetMasterThread::FCPConnect trying to connect to node "+m_fcphost);\r
\r
if(m_fcp.Connect(m_fcphost.c_str(),m_fcpport)==true)\r
{\r
// send ClientHello message to node\r
m_fcp.SendMessage("ClientHello",2,"Name",clientname.c_str(),"ExpectedVersion","2.0");\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" connected to node");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_INFO,"FreenetMasterThread::FCPConnect connected to node");\r
\r
return true;\r
}\r
{\r
info+="\t\t\t\t"+(*mi).first+"="+(*mi).second+"\r\n";\r
}\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" received unhandled "+message.GetName()+" message. Message content :\r\n"+info);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"FreenetMasterThread::HandleMessage received unhandled "+message.GetName()+" message. Message content :\r\n"+info);\r
\r
// if unhandled message was alldata - we must retrieve the data\r
if(message.GetName()=="AllData")\r
}\r
else\r
{\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" received "+message.GetName()+" message before NodeHello");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::HandleMessage received "+message.GetName()+" message before NodeHello");\r
}\r
\r
return false;\r
m_processors.push_back(obj);\r
}\r
\r
-void FreenetMasterThread::run()\r
+void FreenetMasterThread::Run()\r
{\r
\r
FCPMessage message;\r
bool done=false;\r
\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"FreenetMasterThread::run thread started.");\r
+\r
Setup();\r
\r
do\r
if(FCPConnect()==false)\r
{\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" could not connect to node. Waiting 60 seconds.");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::run could not connect to node. Waiting 60 seconds.");\r
\r
// wait 60 seconds - will then try to connect again\r
+ /*\r
try\r
{\r
ZThread::Thread::sleep(60000);\r
{\r
done=true;\r
}\r
+ */\r
+ for(int i=0; i<60 && !IsCancelled(); i++)\r
+ {\r
+ Sleep(1000);\r
+ }\r
}\r
}\r
// fcp is connected\r
}\r
\r
}\r
- }while(!ZThread::Thread::interrupted() && done==false);\r
+// }while(!ZThread::Thread::interrupted() && done==false);\r
+ }while(!IsCancelled() && done==false);\r
\r
m_fcp.Disconnect();\r
\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 MessageListRequester(&m_fcp));\r
+ m_registrables.push_back(new MessageRequester(&m_fcp));\r
+ m_registrables.push_back(new MessageInserter(&m_fcp));\r
+ m_registrables.push_back(new MessageListInserter(&m_fcp));\r
\r
for(std::vector<IFreenetRegistrable *>::iterator i=m_registrables.begin(); i!=m_registrables.end(); i++)\r
{\r