aboutsummaryrefslogtreecommitdiff
path: root/irc.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-11-18 19:19:41 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-11-18 19:19:41 +0000
commitc5c7911dab8732861affbe66849a100da62f7464 (patch)
treebfbb16bc8fbcb4911a24a5e32f9f4c3c280f392c /irc.cpp
parentb349e3dca89dfff5fe70669f9fd3f3a1ec60a498 (diff)
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 git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@40 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'irc.cpp')
-rw-r--r--irc.cpp14
1 files changed, 9 insertions, 5 deletions
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)
{