X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnntp%2Fnntplistener.cpp;h=01b008d86b7ee1db48839713c307a7b1a2176661;hb=964f55fd550fc711c0320ce6a24ad713040695d0;hp=4d1c37dba0fe8bdca85f22d0311068f5e15758a4;hpb=6b896a9e1dc143bba86795be1e9336549db9b85f;p=fms.git diff --git a/src/nntp/nntplistener.cpp b/src/nntp/nntplistener.cpp index 4d1c37d..01b008d 100644 --- a/src/nntp/nntplistener.cpp +++ b/src/nntp/nntplistener.cpp @@ -9,7 +9,8 @@ #include #include #else - + #include // gcc - IPPROTO_ consts + #include // gcc - addrinfo #endif #ifdef XMEM @@ -29,7 +30,7 @@ NNTPListener::~NNTPListener() void NNTPListener::run() { int rval; - struct fd_set readfs; + fd_set readfs; struct timeval tv; std::vector::iterator listeni; SOCKET highsocket; @@ -81,16 +82,31 @@ void NNTPListener::run() // see if any threads are still running - just calling interrupt without check would cause assert in debug mode if(m_connections.wait(1)==false) { + LogFile::instance()->WriteLog(LogFile::LOGLEVEL_DEBUG,"NNTPListener::run interrupting connection threads and waiting 60 seconds for exit."); try { m_connections.interrupt(); } catch(...) { + LogFile::instance()->WriteLog(LogFile::LOGLEVEL_DEBUG,"NNTPListener::run caught unhandled exception."); + } + if(m_connections.wait(60)==false) + { + LogFile::instance()->WriteLog(LogFile::LOGLEVEL_DEBUG,"NNTPListener::run connection threads did not exit after 60 seconds."); } - m_connections.wait(); } + for(listeni=m_listensockets.begin(); listeni!=m_listensockets.end(); listeni++) + { + #ifdef _WIN32 + closesocket((*listeni)); + #else + close((*listeni)); + #endif + } + m_listensockets.clear(); + } void NNTPListener::StartListen()