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