X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnntp%2Fnntplistener.cpp;h=a34fc15bb15f6eba8448092455b132ddbe911655;hb=59a5414ec47a2932a7802fcd1d98c4d80166564f;hp=6355ebc1abba88164736a9c62b341400c48d0557;hpb=cd75427de26fc2ebc9baad558b1c0a081faa3b43;p=fms.git diff --git a/src/nntp/nntplistener.cpp b/src/nntp/nntplistener.cpp index 6355ebc..a34fc15 100644 --- a/src/nntp/nntplistener.cpp +++ b/src/nntp/nntplistener.cpp @@ -40,6 +40,8 @@ void NNTPListener::run() m_log->debug("NNTPListener::run thread started."); + LoadDatabase(); + StartListen(); do @@ -104,19 +106,22 @@ void NNTPListener::run() void NNTPListener::StartListen() { - std::string bindaddresses; std::vector listenaddresses; + std::string bindaddresses; std::string nntpport; - if(Option::Instance()->Get("NNTPListenPort",nntpport)==false) + Option option(m_db); + + if(option.Get("NNTPListenPort",nntpport)==false) { nntpport="1119"; - Option::Instance()->Set("NNTPListenPort",nntpport); + option.Set("NNTPListenPort",nntpport); } - if(Option::Instance()->Get("NNTPBindAddresses",bindaddresses)==false) + if(option.Get("NNTPBindAddresses",bindaddresses)==false) { bindaddresses="127.0.0.1"; - Option::Instance()->Set("NNTPBindAddresses",bindaddresses); + option.Set("NNTPBindAddresses",bindaddresses); } + StringFunctions::Split(bindaddresses,",",listenaddresses); for(std::vector::iterator i=listenaddresses.begin(); i!=listenaddresses.end(); i++) @@ -159,7 +164,7 @@ void NNTPListener::StartListen() } else { - m_log->error("NNTPListener::StartListen socket listen failed"); + m_log->error("NNTPListener::StartListen socket listen failed on "+sa.toString()); #ifdef _WIN32 closesocket(sock); #else @@ -169,7 +174,7 @@ void NNTPListener::StartListen() } else { - m_log->error("NNTPListener::StartListen socket bind failed"); + m_log->error("NNTPListener::StartListen socket bind failed on "+sa.toString()); #ifdef _WIN32 closesocket(sock); #else @@ -179,7 +184,7 @@ void NNTPListener::StartListen() } else { - m_log->error("NNTPListener::StartListen couldn't create socket"); + m_log->error("NNTPListener::StartListen couldn't create socket on "+sa.toString()); } } catch(Poco::Exception &e)