aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp2
-rw-r--r--src/net.cpp2
-rw-r--r--src/net.h2
-rw-r--r--src/script.h2
-rw-r--r--src/serialize.h9
5 files changed, 9 insertions, 8 deletions
diff --git a/src/init.cpp b/src/init.cpp
index b25d52200f..5c87af9112 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -239,7 +239,7 @@ std::string HelpMessage()
" -banscore=<n> " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n" +
" -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" +
" -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n" +
- " -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 5000)") + "\n" +
+ " -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n" +
#ifdef USE_UPNP
#if USE_UPNP
" -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n" +
diff --git a/src/net.cpp b/src/net.cpp
index 2d1f708edc..e10829aca3 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -938,8 +938,6 @@ void ThreadSocketHandler2(void* parg)
pnode->CloseSocketDisconnect();
}
}
- if (vSend.size() > SendBufferSize())
- printf("socket send buffer full warning (%d bytes)\n", vSend.size());
}
}
}
diff --git a/src/net.h b/src/net.h
index 21ecaef848..f6608bc030 100644
--- a/src/net.h
+++ b/src/net.h
@@ -27,7 +27,7 @@ extern int nBestHeight;
inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
-inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 5*1000); }
+inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
void AddOneShot(std::string strDest);
bool RecvLine(SOCKET hSocket, std::string& strLine);
diff --git a/src/script.h b/src/script.h
index d490cd1824..e2b83bd6ee 100644
--- a/src/script.h
+++ b/src/script.h
@@ -452,7 +452,7 @@ public:
memcpy(&nSize, &pc[0], 4);
pc += 4;
}
- if (end() - pc < nSize)
+ if (end() - pc < 0 || (unsigned int)(end() - pc) < nSize)
return false;
if (pvchRet)
pvchRet->assign(pc, pc + nSize);
diff --git a/src/serialize.h b/src/serialize.h
index 349a40bfe8..abc4f04a0d 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -809,7 +809,8 @@ public:
void insert(iterator it, const_iterator first, const_iterator last)
{
- if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+ assert(last - first >= 0);
+ if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);
@@ -821,7 +822,8 @@ public:
void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
{
- if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+ assert(last - first >= 0);
+ if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);
@@ -834,7 +836,8 @@ public:
#if !defined(_MSC_VER) || _MSC_VER >= 1300
void insert(iterator it, const char* first, const char* last)
{
- if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+ assert(last - first >= 0);
+ if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);