lib/curl/Request: allow Stop() to be called twice

Convert assertion to runtime check.  This is useful because this is a
public method, and the caller has no chance to check if the object is
still registered.
This commit is contained in:
Max Kellermann 2017-01-08 13:51:03 +01:00
parent 3c66feff5a
commit dc53098e43

View File

@ -81,7 +81,8 @@ CurlRequest::Start()
void void
CurlRequest::Stop() CurlRequest::Stop()
{ {
assert(registered); if (!registered)
return;
global.Remove(easy.Get()); global.Remove(easy.Get());
registered = false; registered = false;
@ -93,8 +94,7 @@ CurlRequest::FreeEasy()
if (!easy) if (!easy)
return; return;
if (registered) Stop();
Stop();
easy = nullptr; easy = nullptr;
} }