From 9decdd198e4e08db9169143c82f6c7cdb6f01eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 21 Jul 2023 10:27:31 +0200 Subject: [PATCH] Address more feedback, minor cleanup --- Common/Net/HTTPNaettRequest.cpp | 5 +++-- Core/Util/PortManager.cpp | 2 -- Core/Util/PortManager.h | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Common/Net/HTTPNaettRequest.cpp b/Common/Net/HTTPNaettRequest.cpp index c56295aae4..bb6888cc4a 100644 --- a/Common/Net/HTTPNaettRequest.cpp +++ b/Common/Net/HTTPNaettRequest.cpp @@ -70,7 +70,8 @@ bool HTTPSDownload::Done() { return false; } - resultCode_ = naettGetStatus(res_); + // -1000 is a code specified by us to represent cancellation, that is unlikely to ever collide with naett error codes. + resultCode_ = IsCancelled() ? -1000 : naettGetStatus(res_); if (resultCode_ < 0) { // It's a naett error. Translate and handle. switch (resultCode_) { @@ -86,7 +87,7 @@ bool HTTPSDownload::Done() { case naettWriteError: // -4 ERROR_LOG(IO, "Write error"); break; - case naettGenericError: // -4 + case naettGenericError: // -5 ERROR_LOG(IO, "Generic error"); break; default: diff --git a/Core/Util/PortManager.cpp b/Core/Util/PortManager.cpp index d4103e0e75..cfb81e9dbd 100644 --- a/Core/Util/PortManager.cpp +++ b/Core/Util/PortManager.cpp @@ -49,8 +49,6 @@ std::recursive_mutex upnpLock; std::deque upnpReqs; PortManager::PortManager(): - urls(0), - datas(0), m_InitState(UPNP_INITSTATE_NONE), m_LocalPort(UPNP_LOCAL_PORT_ANY), m_leaseDuration("43200") { diff --git a/Core/Util/PortManager.h b/Core/Util/PortManager.h index f284788a38..31b9f67f95 100644 --- a/Core/Util/PortManager.h +++ b/Core/Util/PortManager.h @@ -108,8 +108,8 @@ private: // Uninitialize/Reset the state void Terminate(); - struct UPNPUrls* urls = NULL; - struct IGDdatas* datas = NULL; + struct UPNPUrls* urls = nullptr; + struct IGDdatas* datas = nullptr; int m_InitState = UPNP_INITSTATE_NONE; int m_LocalPort = UPNP_LOCAL_PORT_ANY;