aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorGavin Andresen <[email protected]>2013-11-03 21:52:25 -0800
committerGavin Andresen <[email protected]>2013-11-03 21:52:25 -0800
commit97f844dd95c54b0fe2f2a1bb006c74ff544ff125 (patch)
tree6d08ffa5ec8ae6e5efd6953c6eed3d154d26155c /src/main.cpp
parentMerge pull request #3154 from gavinandresen/mempool_refactor (diff)
parentprocess received messages one at a time without sleeping between messages (diff)
downloaddiscoin-97f844dd95c54b0fe2f2a1bb006c74ff544ff125.tar.xz
discoin-97f844dd95c54b0fe2f2a1bb006c74ff544ff125.zip
Merge pull request #3180 from pstratem/processgetdata
Reduce latency in network processing
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index ecb971166..4dc2e5c6f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3155,6 +3155,9 @@ void static ProcessGetData(CNode* pfrom)
// Track requests for our stuff.
g_signals.Inventory(inv.hash);
+
+ if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK)
+ break;
}
}
@@ -3841,7 +3844,10 @@ bool ProcessMessages(CNode* pfrom)
if (!pfrom->vRecvGetData.empty())
ProcessGetData(pfrom);
-
+
+ // this maintains the order of responses
+ if (!pfrom->vRecvGetData.empty()) return fOk;
+
std::deque<CNetMessage>::iterator it = pfrom->vRecvMsg.begin();
while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) {
// Don't bother if send buffer is too full to respond anyway
@@ -3929,6 +3935,8 @@ bool ProcessMessages(CNode* pfrom)
if (!fRet)
LogPrintf("ProcessMessage(%s, %u bytes) FAILED\n", strCommand.c_str(), nMessageSize);
+
+ break;
}
// In case the connection got shut down, its receive buffer was wiped