From c6958302f07971825a8ca3c76f55c77bb5f214d6 Mon Sep 17 00:00:00 2001 From: aiwe Date: Fri, 27 Jul 2018 01:58:50 +0300 Subject: [PATCH] Revert "Optimizations" This reverts commit 063d0015e1e1cecaca5af7b4080ed735ffbf762b. --- src/System/TcpStream.cpp | 4 +--- src/Transfers/TransfersConsumer.cpp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/System/TcpStream.cpp b/src/System/TcpStream.cpp index b0a9f2204d..57227cf7bb 100644 --- a/src/System/TcpStream.cpp +++ b/src/System/TcpStream.cpp @@ -82,9 +82,7 @@ bool TcpStreambuf::dumpBuffer(bool finalize) { } else { if(!finalize) { size_t front = 0; - size_t pos = transferred; - for (uint64_t i = count - transferred; i--; ) { - ++pos, ++front; + for (size_t pos = transferred; pos < count; ++pos, ++front) { writeBuf[front] = writeBuf[pos]; } diff --git a/src/Transfers/TransfersConsumer.cpp b/src/Transfers/TransfersConsumer.cpp index 58cccdcbb7..715536fcb6 100644 --- a/src/Transfers/TransfersConsumer.cpp +++ b/src/Transfers/TransfersConsumer.cpp @@ -210,8 +210,7 @@ bool TransfersConsumer::onNewBlocks(const CompleteBlock* blocks, uint32_t startH std::atomic stopProcessing(false); auto pushingThread = std::async(std::launch::async, [&] { - uint32_t i = 0; - for (uint32_t j = count - 1; j--; ) { + for( uint32_t i = 0; i < count && !stopProcessing; ++i) { const auto& block = blocks[i].block; if (!block.is_initialized()) { @@ -239,7 +238,6 @@ bool TransfersConsumer::onNewBlocks(const CompleteBlock* blocks, uint32_t startH inputQueue.push(item); ++blockInfo.transactionIndex; } - i++; } inputQueue.close();