Properly handle -1 value passed to curl set_timeout.

This commit is contained in:
rakshasa
2025-06-08 12:44:38 +02:00
committed by Jari Sundell
parent b4c59d2c7a
commit b9d880dea3
+5 -1
View File
@@ -236,7 +236,11 @@ int
CurlStack::set_timeout(void*, long timeout_ms, void* userp) {
CurlStack* stack = (CurlStack*)userp;
torrent::this_thread::scheduler()->update_wait_for_ceil_seconds(&stack->m_task_timeout, std::chrono::milliseconds(timeout_ms));
if (timeout_ms == -1)
torrent::this_thread::scheduler()->erase(&stack->m_task_timeout);
else
torrent::this_thread::scheduler()->update_wait_for_ceil_seconds(&stack->m_task_timeout, std::chrono::milliseconds(timeout_ms));
return 0;
}