aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 3966706207..ab547e2fd7 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -48,8 +48,8 @@
#endif
#endif
-using namespace std;
using namespace boost;
+using namespace std;
namespace {
const int MAX_OUTBOUND_CONNECTIONS = 8;
@@ -488,10 +488,6 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest)
{
addrman.Attempt(addrConnect);
- // Set to non-blocking
- if (!SetSocketNonBlocking(hSocket, true))
- LogPrintf("ConnectNode: Setting socket to non-blocking failed, error %s\n", NetworkErrorString(WSAGetLastError()));
-
// Add node
CNode* pnode = new CNode(hSocket, addrConnect, pszDest ? pszDest : "", false);
pnode->AddRef();
@@ -689,7 +685,7 @@ int CNetMessage::readHeader(const char *pch, unsigned int nBytes)
try {
hdrbuf >> hdr;
}
- catch (std::exception &e) {
+ catch (const std::exception &) {
return -1;
}
@@ -1080,8 +1076,6 @@ void ThreadSocketHandler()
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->Release();
}
-
- MilliSleep(10);
}
}
@@ -1791,7 +1785,6 @@ bool StopNode()
if (semOutbound)
for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++)
semOutbound->post();
- MilliSleep(50);
DumpAddresses();
return true;
@@ -2109,6 +2102,8 @@ CNode::~CNode()
void CNode::AskFor(const CInv& inv)
{
+ if (mapAskFor.size() > MAPASKFOR_MAX_SZ)
+ return;
// We're using mapAskFor as a priority queue,
// the key is the earliest time the request can be sent
int64_t nRequestTime;
@@ -2117,7 +2112,7 @@ void CNode::AskFor(const CInv& inv)
nRequestTime = it->second;
else
nRequestTime = 0;
- LogPrint("net", "askfor %s %d (%s) peer=%d\n", inv.ToString(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str(), id);
+ LogPrint("net", "askfor %s %d (%s) peer=%d\n", inv.ToString(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000), id);
// Make sure not to reuse time indexes to keep things in the same order
int64_t nNow = GetTimeMicros() - 1000000;