\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
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
#include <Poco/PatternFormatter.h>\r
#include <iostream>\r
#include <string>\r
+#include <cstring>\r
\r
#ifdef _WIN32\r
#include <direct.h>\r
\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
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
}\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
}\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
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