|
|
@ -129,7 +129,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer) |
|
|
|
bool RecvLine(SOCKET hSocket, string& strLine) |
|
|
|
bool RecvLine(SOCKET hSocket, string& strLine) |
|
|
|
{ |
|
|
|
{ |
|
|
|
strLine = ""; |
|
|
|
strLine = ""; |
|
|
|
loop |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char c; |
|
|
|
char c; |
|
|
|
int nBytes = recv(hSocket, &c, 1, 0); |
|
|
|
int nBytes = recv(hSocket, &c, 1, 0); |
|
|
@ -301,7 +301,7 @@ bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const cha |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (strLine.empty()) // HTTP response is separated from headers by blank line
|
|
|
|
if (strLine.empty()) // HTTP response is separated from headers by blank line
|
|
|
|
{ |
|
|
|
{ |
|
|
|
loop |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!RecvLine(hSocket, strLine)) |
|
|
|
if (!RecvLine(hSocket, strLine)) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -741,7 +741,7 @@ static list<CNode*> vNodesDisconnected; |
|
|
|
void ThreadSocketHandler() |
|
|
|
void ThreadSocketHandler() |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned int nPrevNodeCount = 0; |
|
|
|
unsigned int nPrevNodeCount = 0; |
|
|
|
loop |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//
|
|
|
|
//
|
|
|
|
// Disconnect nodes
|
|
|
|
// Disconnect nodes
|
|
|
@ -1105,7 +1105,7 @@ void ThreadMapPort() |
|
|
|
string strDesc = "Bitcoin " + FormatFullVersion(); |
|
|
|
string strDesc = "Bitcoin " + FormatFullVersion(); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
loop { |
|
|
|
while (true) { |
|
|
|
#ifndef UPNPDISCOVER_SUCCESS |
|
|
|
#ifndef UPNPDISCOVER_SUCCESS |
|
|
|
/* miniupnpc 1.5 */ |
|
|
|
/* miniupnpc 1.5 */ |
|
|
|
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, |
|
|
|
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, |
|
|
@ -1268,7 +1268,7 @@ void ThreadOpenConnections() |
|
|
|
|
|
|
|
|
|
|
|
// Initiate network connections
|
|
|
|
// Initiate network connections
|
|
|
|
int64 nStart = GetTime(); |
|
|
|
int64 nStart = GetTime(); |
|
|
|
loop |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ProcessOneShot(); |
|
|
|
ProcessOneShot(); |
|
|
|
|
|
|
|
|
|
|
@ -1309,7 +1309,7 @@ void ThreadOpenConnections() |
|
|
|
int64 nANow = GetAdjustedTime(); |
|
|
|
int64 nANow = GetAdjustedTime(); |
|
|
|
|
|
|
|
|
|
|
|
int nTries = 0; |
|
|
|
int nTries = 0; |
|
|
|
loop |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
|
|
|
|
// use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
|
|
|
|
CAddress addr = addrman.Select(10 + min(nOutbound,8)*10); |
|
|
|
CAddress addr = addrman.Select(10 + min(nOutbound,8)*10); |
|
|
|