X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnntp%2Fnntpconnection.cpp;h=0ccef18ae7ad859b00668a003fdd94211d1ccc10;hb=c7fcb4c4bc5012a584add81a9509fc1f84c3c688;hp=ac75d4d310ffb0f931252a23b4f71ba3a950345a;hpb=868c533e84b3c81b6604b45b84efa32073aa20b4;p=fms.git diff --git a/src/nntp/nntpconnection.cpp b/src/nntp/nntpconnection.cpp index ac75d4d..0ccef18 100644 --- a/src/nntp/nntpconnection.cpp +++ b/src/nntp/nntpconnection.cpp @@ -7,7 +7,10 @@ #include "../../include/messagelist.h" #include "../../include/option.h" -#include +#include + +//#include +#include "../../include/pthreadwrapper/thread.h" #ifdef XMEM #include @@ -26,7 +29,7 @@ NNTPConnection::NNTPConnection(SOCKET sock) m_status.m_messageid=-1; m_status.m_mode=MODE_NONE; - Option::instance()->Get("NNTPAllowPost",tempval); + Option::Instance()->Get("NNTPAllowPost",tempval); if(tempval=="true") { m_status.m_allowpost=true; @@ -230,7 +233,7 @@ const bool NNTPConnection::HandleLastCommand(const NNTPCommand &command) { Message mess; - if(mess.Load(m_status.m_messageid,m_status.m_boardid)) + if(mess.LoadPrevious(m_status.m_messageid,m_status.m_boardid)) { std::ostringstream tempstr; @@ -583,7 +586,7 @@ const bool NNTPConnection::HandleNextCommand(const NNTPCommand &command) { Message mess; - if(mess.Load(m_status.m_messageid,m_status.m_boardid)) + if(mess.LoadNext(m_status.m_messageid,m_status.m_boardid)) { std::ostringstream tempstr; @@ -862,7 +865,7 @@ const bool NNTPConnection::HandleQuitCommand(const NNTPCommand &command) return true; } -void NNTPConnection::run() +void NNTPConnection::Run() { struct timeval tv; fd_set writefs,readfs; @@ -908,15 +911,16 @@ void NNTPConnection::run() SocketSend(); } } - else if(rval==-1) + else if(rval==SOCKET_ERROR) { m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"NNTPConnection::run select returned -1 : "+GetSocketErrorMessage()); } - }while(!Disconnected() && !ZThread::Thread::interrupted()); - +// }while(!Disconnected() && !ZThread::Thread::interrupted()); + }while(!Disconnected() && !IsCancelled()); + Disconnect(); - + } void NNTPConnection::SendArticleOverInfo(Message &message) @@ -1163,9 +1167,11 @@ void NNTPConnection::SocketReceive() } else if(rval==-1) { + std::string errnostr; + StringFunctions::Convert(GetSocketErrorNumber(),errnostr); // error on receive - close the connection Disconnect(); - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"NNTPConnection::SocketReceive recv returned -1 : "+GetSocketErrorMessage()); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"NNTPConnection::SocketReceive recv returned -1 : "+errnostr+" - "+GetSocketErrorMessage()); } } @@ -1180,7 +1186,9 @@ void NNTPConnection::SocketSend() } else if(rval==-1) { - m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"NNTPConnection::SocketSend returned -1 : "+GetSocketErrorMessage()); + std::string errnostr; + StringFunctions::Convert(GetSocketErrorNumber(),errnostr); + m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"NNTPConnection::SocketSend returned -1 : "+errnostr+" - "+GetSocketErrorMessage()); } } }