mirror of
https://github.com/transmission/transmission
synced 2025-01-02 13:05:08 +00:00
fix: crash in curl_easy_pause() (#5161)
This commit is contained in:
parent
08ed1cf54c
commit
b2b0f0db39
1 changed files with 6 additions and 4 deletions
|
@ -351,6 +351,8 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl.paused_easy_handles.erase(easy_);
|
||||||
|
|
||||||
if (auto const url = tr_urlParse(options.url); url)
|
if (auto const url = tr_urlParse(options.url); url)
|
||||||
{
|
{
|
||||||
curl_easy_reset(easy);
|
curl_easy_reset(easy);
|
||||||
|
@ -462,7 +464,7 @@ public:
|
||||||
// again when the transfer is unpaused.
|
// again when the transfer is unpaused.
|
||||||
if (task->impl.mediator.clamp(*tag, bytes_used) < bytes_used)
|
if (task->impl.mediator.clamp(*tag, bytes_used) < bytes_used)
|
||||||
{
|
{
|
||||||
task->impl.paused_easy_handles.emplace(tr_time_msec(), task->easy());
|
task->impl.paused_easy_handles.emplace(task->easy(), tr_time_msec());
|
||||||
return CURL_WRITEFUNC_PAUSE;
|
return CURL_WRITEFUNC_PAUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,9 +603,9 @@ public:
|
||||||
|
|
||||||
for (auto it = std::begin(paused); it != std::end(paused);)
|
for (auto it = std::begin(paused); it != std::end(paused);)
|
||||||
{
|
{
|
||||||
if (it->first + BandwidthPauseMsec < now)
|
if (it->second + BandwidthPauseMsec < now)
|
||||||
{
|
{
|
||||||
curl_easy_pause(it->second, CURLPAUSE_CONT);
|
curl_easy_pause(it->first, CURLPAUSE_CONT);
|
||||||
it = paused.erase(it);
|
it = paused.erase(it);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -777,7 +779,7 @@ public:
|
||||||
|
|
||||||
static inline auto curl_init_flag = std::once_flag{};
|
static inline auto curl_init_flag = std::once_flag{};
|
||||||
|
|
||||||
std::multimap<uint64_t /*tr_time_msec()*/, CURL*> paused_easy_handles;
|
std::map<CURL*, uint64_t /*tr_time_msec()*/> paused_easy_handles;
|
||||||
|
|
||||||
static void curlInit()
|
static void curlInit()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue