From aa0b0d3cbfc6c4561591df856396703f7177292e Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Sat, 20 Apr 2024 13:22:05 +0200 Subject: import oplog improvements (#54) * report down/up transfer speed during progress * add disk buffering in http client * offload block decoding and chunk writing form network worker pool threads add block hash verification for blocks recevied at oplog import * separate download-latch from write-latch to get more accurate download speed * check headers when downloading with http client to go directly to file writing for large payloads * we must clear write callback even if we only provide it as an argument to the Download() call * make timeout optional in AddSponsorProcess * check return codes when creating windows threadpool --- src/zencore/workthreadpool.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/zencore/workthreadpool.cpp') diff --git a/src/zencore/workthreadpool.cpp b/src/zencore/workthreadpool.cpp index f41c13bf6..d15fb2e83 100644 --- a/src/zencore/workthreadpool.cpp +++ b/src/zencore/workthreadpool.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -56,18 +57,33 @@ struct WorkerThreadPool::Impl // Thread pool setup m_ThreadPool = CreateThreadpool(NULL); + if (m_ThreadPool == NULL) + { + ThrowLastError("CreateThreadpool failed"); + } - SetThreadpoolThreadMinimum(m_ThreadPool, InThreadCount); + if (!SetThreadpoolThreadMinimum(m_ThreadPool, InThreadCount)) + { + ThrowLastError("SetThreadpoolThreadMinimum failed"); + } SetThreadpoolThreadMaximum(m_ThreadPool, InThreadCount * 2); InitializeThreadpoolEnvironment(&m_CallbackEnvironment); m_CleanupGroup = CreateThreadpoolCleanupGroup(); + if (m_CleanupGroup == NULL) + { + ThrowLastError("CreateThreadpoolCleanupGroup failed"); + } SetThreadpoolCallbackPool(&m_CallbackEnvironment, m_ThreadPool); SetThreadpoolCallbackCleanupGroup(&m_CallbackEnvironment, m_CleanupGroup, NULL); m_Work = CreateThreadpoolWork(&WorkCallback, this, &m_CallbackEnvironment); + if (m_Work == NULL) + { + ThrowLastError("CreateThreadpoolWork failed"); + } } ~Impl() -- cgit v1.2.3