version 0.0.4
[fms.git] / src / freenet / freenetmasterthread.cpp
index 01f03a0..bef4930 100644 (file)
@@ -1,5 +1,6 @@
 #include "../../include/freenet/freenetmasterthread.h"\r
 #include "../../include/option.h"\r
+#include "../../include/uuidgenerator.h"\r
 #include "../../include/stringfunctions.h"\r
 #include "../../include/freenet/unkeyedidcreator.h"\r
 #include "../../include/freenet/identityinserter.h"\r
@@ -9,6 +10,8 @@
 #include "../../include/freenet/introductionpuzzlerequester.h"\r
 #include "../../include/freenet/introductionpuzzleremover.h"\r
 #include "../../include/freenet/identityintroductioninserter.h"\r
+#include "../../include/freenet/trustlistinserter.h"\r
+#include "../../include/freenet/trustlistrequester.h"\r
 \r
 #include <zthread/Thread.h>\r
 \r
@@ -59,14 +62,16 @@ const bool FreenetMasterThread::FCPConnect()
                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
+               UUIDGenerator uuid;\r
+               std::string clientname="FMSClient-"+uuid.Generate();\r
                // send ClientHello message to node\r
-               m_fcp.SendMessage("ClientHello",2,"Name","FMSClient","ExpectedVersion","2.0");\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
@@ -108,7 +113,7 @@ const bool FreenetMasterThread::HandleMessage(FCPMessage &message)
                        {\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
@@ -133,7 +138,7 @@ const bool FreenetMasterThread::HandleMessage(FCPMessage &message)
        }\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
@@ -169,7 +174,7 @@ void FreenetMasterThread::run()
                        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
                                try\r
@@ -228,6 +233,8 @@ void FreenetMasterThread::Setup()
        m_registrables.push_back(new IntroductionPuzzleRequester(&m_fcp));\r
        m_registrables.push_back(new IntroductionPuzzleRemover());\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
 \r
        for(std::vector<IFreenetRegistrable *>::iterator i=m_registrables.begin(); i!=m_registrables.end(); i++)\r
        {\r
@@ -238,9 +245,9 @@ void FreenetMasterThread::Setup()
 \r
 void FreenetMasterThread::Shutdown()\r
 {\r
-       // delete each registerable object\r
+       // delete each registrable object\r
        for(std::vector<IFreenetRegistrable *>::iterator i=m_registrables.begin(); i!=m_registrables.end(); i++)\r
        {\r
                delete (*i);\r
        }\r
-}
\ No newline at end of file
+}\r