From e4db374421cac4c6fd0d9f9b337d9073e5207c21 Mon Sep 17 00:00:00 2001 From: s_nakamoto Date: Wed, 18 Nov 2009 19:19:41 +0000 Subject: bugfix Db::open/close and zombie sockets bugs fix double-close of socket handle, keep databases open, close db cursors, initial block download in batches of 500 blocks, fix misc warnings, subver linux-test8 --- irc.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'irc.cpp') diff --git a/irc.cpp b/irc.cpp index 8432c6d145..8ac38380eb 100644 --- a/irc.cpp +++ b/irc.cpp @@ -159,15 +159,12 @@ void ThreadIRCSeed(void* parg) SetThreadPriority(THREAD_PRIORITY_NORMAL); int nErrorWait = 10; int nRetryWait = 10; - - // IRC server blocks TOR users - if (fUseProxy && addrProxy.port == htons(9050)) - return; + bool fTOR = (fUseProxy && addrProxy.port == htons(9050)); while (!fShutdown) { CAddress addrConnect("216.155.130.130:6667"); - if (!(fUseProxy && addrProxy.port == htons(9050))) + if (!fTOR) { struct hostent* phostent = gethostbyname("chat.freenode.net"); if (phostent && phostent->h_addr_list && phostent->h_addr_list[0]) @@ -188,6 +185,7 @@ void ThreadIRCSeed(void* parg) if (!RecvUntil(hSocket, "Found your hostname", "using your IP address instead", "Couldn't look up your hostname")) { closesocket(hSocket); + hSocket = INVALID_SOCKET; nErrorWait = nErrorWait * 11 / 10; if (Wait(nErrorWait += 60)) continue; @@ -208,6 +206,7 @@ void ThreadIRCSeed(void* parg) if (!RecvUntil(hSocket, " 004 ")) { closesocket(hSocket); + hSocket = INVALID_SOCKET; nErrorWait = nErrorWait * 11 / 10; if (Wait(nErrorWait += 60)) continue; @@ -269,6 +268,11 @@ void ThreadIRCSeed(void* parg) } } closesocket(hSocket); + hSocket = INVALID_SOCKET; + + // IRC usually blocks TOR, so only try once + if (fTOR) + return; if (GetTime() - nStart > 20 * 60) { -- cgit v1.2.3