version 0.3.8
authorSomeDude <SomeDude@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw>
Sat, 12 Jul 2008 13:53:00 +0000 (15:53 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 12 Jul 2008 13:53:00 +0000 (15:53 +0200)
include/global.h
readme.txt
src/fmsapp.cpp
src/freenet/freenetmasterthread.cpp
src/nntp/nntplistener.cpp
src/optionssetup.cpp

index 34eb58a..8b4feab 100644 (file)
@@ -7,7 +7,7 @@
 \r
 #define VERSION_MAJOR          "0"\r
 #define VERSION_MINOR          "3"\r
-#define VERSION_RELEASE                "7"\r
+#define VERSION_RELEASE                "8"\r
 #define FMS_VERSION                    VERSION_MAJOR"."VERSION_MINOR"."VERSION_RELEASE\r
 \r
 typedef Poco::ScopedLock<Poco::FastMutex> Guard;\r
index 3df7b4b..4ac04fc 100644 (file)
@@ -42,13 +42,14 @@ startup type in the service properties.
 If you are experiencing a problem with FMS that you can't solve, and you've\r
 already rebooted your machine, restarted FMS, and have reproduced the problem\r
 with a brand new database, follow these instructions.  Set the logging option\r
-to trace and restart FMS.  Create a post on the fms group that contains the\r
-operating system you are using, along with a description of the problem, what\r
-you have tried already, if you are using a precompiled binary, the startup\r
-lines from the log file as well as the portion that corresponds to the problem\r
-you are experiencing, and any other information you have that pertains to the\r
-problem.  Make sure to anonymize any IP addresses, host names, subnet masks,\r
-and keys from the log that you don't want people to know about.\r
+to trace and restart FMS.  Create a post on the fms group with a descriptive\r
+subject and a body that contains the operating system you are using, along with\r
+a description of the problem, what you have tried already, if you are using a\r
+precompiled binary, the startup lines from the log file as well as the portion\r
+that corresponds to the problem you are experiencing, and any other information\r
+you have that pertains to the problem.  Make sure to anonymize any IP addresses,\r
+host names, subnet masks, and keys from the log that you don't want people to\r
+know about.\r
 \r
 EXITING\r
 -------\r
index b30c1ba..ebebe4a 100644 (file)
@@ -18,6 +18,7 @@
 #include <Poco/PatternFormatter.h>\r
 #include <iostream>\r
 #include <string>\r
+#include <cstring>\r
 \r
 #ifdef _WIN32\r
        #include <direct.h>\r
index 4d16043..b957c50 100644 (file)
@@ -200,70 +200,81 @@ void FreenetMasterThread::run()
 \r
        do\r
        {\r
-               if(m_fcp.Connected()==false)\r
+               try\r
                {\r
-                       // wait at least 1 minute since last successful connect\r
-                       now=Poco::Timestamp();\r
-                       if(lastconnected<=(now-Poco::Timespan(0,0,1,0,0)))\r
+                       if(m_fcp.Connected()==false)\r
                        {\r
-                               if(FCPConnect()==false)\r
+                               // wait at least 1 minute since last successful connect\r
+                               now=Poco::Timestamp();\r
+                               if(lastconnected<=(now-Poco::Timespan(0,0,1,0,0)))\r
                                {\r
+                                       if(FCPConnect()==false)\r
+                                       {\r
 \r
-                                       m_log->error("FreenetMasterThread::run could not connect to node.  Waiting 60 seconds.");\r
+                                               m_log->error("FreenetMasterThread::run could not connect to node.  Waiting 60 seconds.");\r
 \r
-                                       for(int i=0; i<60 && !IsCancelled(); i++)\r
+                                               for(int i=0; i<60 && !IsCancelled(); i++)\r
+                                               {\r
+                                                       Poco::Thread::sleep(1000);\r
+                                               }\r
+                                       }\r
+                                       else\r
                                        {\r
-                                               Poco::Thread::sleep(1000);\r
+                                               lastreceivedmessage=Poco::Timestamp();\r
+                                               lastconnected=Poco::Timestamp();\r
                                        }\r
                                }\r
                                else\r
                                {\r
-                                       lastreceivedmessage=Poco::Timestamp();\r
-                                       lastconnected=Poco::Timestamp();\r
+                                       Poco::Thread::sleep(1000);\r
                                }\r
                        }\r
+                       // fcp is connected\r
                        else\r
                        {\r
-                               Poco::Thread::sleep(1000);\r
-                       }\r
-               }\r
-               // fcp is connected\r
-               else\r
-               {\r
-                       m_fcp.Update(1);\r
+                               m_fcp.Update(1);\r
 \r
-                       // check for message on receive buffer and handle it\r
-                       if(m_fcp.ReceiveBufferSize()>0)\r
-                       {\r
-                               message.Reset();\r
-                               message=m_fcp.ReceiveMessage();\r
+                               // check for message on receive buffer and handle it\r
+                               if(m_fcp.ReceiveBufferSize()>0)\r
+                               {\r
+                                       message.Reset();\r
+                                       message=m_fcp.ReceiveMessage();\r
 \r
-                               if(message.GetName()!="")\r
+                                       if(message.GetName()!="")\r
+                                       {\r
+                                               HandleMessage(message);\r
+                                               lastreceivedmessage=Poco::Timestamp();\r
+                                       }\r
+                               }\r
+\r
+                               // let objects do their processing\r
+                               for(std::vector<IPeriodicProcessor *>::iterator i=m_processors.begin(); i!=m_processors.end(); i++)\r
                                {\r
-                                       HandleMessage(message);\r
-                                       lastreceivedmessage=Poco::Timestamp();\r
+                                       (*i)->Process();\r
                                }\r
-                       }\r
 \r
-                       // let objects do their processing\r
-                       for(std::vector<IPeriodicProcessor *>::iterator i=m_processors.begin(); i!=m_processors.end(); i++)\r
-                       {\r
-                               (*i)->Process();\r
-                       }\r
+                               // if we haven't received any messages from the node in 10 minutes, something is wrong\r
+                               now=Poco::Timestamp();\r
+                               if(lastreceivedmessage<(now-Poco::Timespan(0,0,10,0,0)))\r
+                               {\r
+                                       m_log->error("FreenetMasterThread::Run The Freenet node has not responded in 10 minutes.  Trying to reconnect.");\r
+                                       m_fcp.Disconnect();\r
+                               }\r
 \r
-                       // if we haven't received any messages from the node in 10 minutes, something is wrong\r
-                       now=Poco::Timestamp();\r
-                       if(lastreceivedmessage<(now-Poco::Timespan(0,0,10,0,0)))\r
-                       {\r
-                               m_log->error("FreenetMasterThread::Run The Freenet node has not responded in 10 minutes.  Trying to reconnect.");\r
-                               m_fcp.Disconnect();\r
-                       }\r
+                               if(m_fcp.Connected()==false)\r
+                               {\r
+                                       m_log->information("FreenetMasterThread::Run Disconnected from Freenet node.");\r
+                               }\r
 \r
-                       if(m_fcp.Connected()==false)\r
-                       {\r
-                               m_log->information("FreenetMasterThread::Run Disconnected from Freenet node.");\r
                        }\r
-\r
+               }\r
+               catch(Poco::Exception &e)\r
+               {\r
+                       m_log->error("FreenetMasterThread::run caught exception : "+e.displayText());\r
+               }\r
+               catch(...)\r
+               {\r
+                       m_log->error("FreenetMasterThread::run caught unknown exception");\r
                }\r
        }while(!IsCancelled() && done==false);\r
 \r
index 860da2c..6355ebc 100644 (file)
@@ -129,32 +129,47 @@ void NNTPListener::StartListen()
                hint.ai_socktype=SOCK_STREAM;\r
                hint.ai_protocol=IPPROTO_TCP;\r
                hint.ai_flags=AI_PASSIVE;\r
+\r
+               m_log->trace("NNTPListener::StartListen getting address info for "+(*i));\r
                \r
                rval=getaddrinfo((*i).c_str(),nntpport.c_str(),&hint,&result);\r
                if(rval==0)\r
                {\r
                        for(current=result; current!=NULL; current=current->ai_next)\r
                        {\r
-                               Poco::Net::SocketAddress sa(current->ai_addr,current->ai_addrlen);\r
-                               m_log->debug("NNTPListener::StartListen trying to create socket, bind, and listen on "+sa.toString());\r
-\r
-                               sock=socket(current->ai_family,current->ai_socktype,current->ai_protocol);\r
-                               if(sock!=INVALID_SOCKET)\r
+                               try\r
                                {\r
-                                       #ifndef _WIN32\r
-                                       const char optval='1';\r
-                                       setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&optval,sizeof(optval));\r
-                                       #endif\r
-                                       if(bind(sock,current->ai_addr,current->ai_addrlen)==0)\r
+                                       Poco::Net::SocketAddress sa(current->ai_addr,current->ai_addrlen);\r
+\r
+                                       m_log->debug("NNTPListener::StartListen trying to create socket, bind, and listen on "+sa.toString());\r
+\r
+                                       sock=socket(current->ai_family,current->ai_socktype,current->ai_protocol);\r
+                                       if(sock!=INVALID_SOCKET)\r
                                        {\r
-                                               if(listen(sock,10)==0)\r
+                                               #ifndef _WIN32\r
+                                               const char optval='1';\r
+                                               setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&optval,sizeof(optval));\r
+                                               #endif\r
+                                               if(bind(sock,current->ai_addr,current->ai_addrlen)==0)\r
                                                {\r
-                                                       m_log->information("NNTPListener::StartListen started listening on "+sa.toString());\r
-                                                       m_listensockets.push_back(sock);\r
+                                                       if(listen(sock,10)==0)\r
+                                                       {\r
+                                                               m_log->information("NNTPListener::StartListen started listening on "+sa.toString());\r
+                                                               m_listensockets.push_back(sock);\r
+                                                       }\r
+                                                       else\r
+                                                       {\r
+                                                               m_log->error("NNTPListener::StartListen socket listen failed");\r
+                                                               #ifdef _WIN32\r
+                                                               closesocket(sock);\r
+                                                               #else\r
+                                                               close(sock);\r
+                                                               #endif\r
+                                                       }\r
                                                }\r
                                                else\r
                                                {\r
-                                                       m_log->error("NNTPListener::StartListen socket listen failed");\r
+                                                       m_log->error("NNTPListener::StartListen socket bind failed");\r
                                                        #ifdef _WIN32\r
                                                        closesocket(sock);\r
                                                        #else\r
@@ -164,17 +179,18 @@ void NNTPListener::StartListen()
                                        }\r
                                        else\r
                                        {\r
-                                               m_log->error("NNTPListener::StartListen socket bind failed");\r
-                                               #ifdef _WIN32\r
-                                               closesocket(sock);\r
-                                               #else\r
-                                               close(sock);\r
-                                               #endif\r
+                                               m_log->error("NNTPListener::StartListen couldn't create socket");\r
                                        }\r
                                }\r
-                               else\r
+                               catch(Poco::Exception &e)\r
+                               {\r
+                                       m_log->error("NNTPListener::StartListen caught "+e.displayText());\r
+                                       continue;\r
+                               }\r
+                               catch(...)\r
                                {\r
-                                       m_log->error("NNTPListener::StartListen couldn't create socket");\r
+                                       m_log->error("NNTPListener::StartListen caught unknown exception");\r
+                                       continue;\r
                                }\r
                        }\r
                }\r
@@ -185,6 +201,6 @@ void NNTPListener::StartListen()
        }\r
        if(m_listensockets.size()==0)\r
        {\r
-               m_log->fatal("NNTPListener::StartListen couldn't start listening on any sockets");\r
+               m_log->fatal("NNTPListener::StartListen couldn't start listening on any interfaces");\r
        }\r
 }\r
index 7965b16..eebd521 100644 (file)
@@ -68,7 +68,7 @@ void SetupDefaultOptions()
        upd.Reset();\r
 \r
        st.Bind(0,"FMSVersionEdition");\r
-       st.Bind(1,"7");\r
+       st.Bind(1,"9");\r
        st.Step();\r
        st.Reset();\r
        upd.Bind(0,"Program");\r