From dc53098e43b95c08f80fa9b383e8e33f2d69e89e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 8 Jan 2017 13:51:03 +0100 Subject: [PATCH] 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. --- src/lib/curl/Request.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/curl/Request.cxx b/src/lib/curl/Request.cxx index 2af6ba881..84ea59b3b 100644 --- a/src/lib/curl/Request.cxx +++ b/src/lib/curl/Request.cxx @@ -81,7 +81,8 @@ CurlRequest::Start() void CurlRequest::Stop() { - assert(registered); + if (!registered) + return; global.Remove(easy.Get()); registered = false; @@ -93,8 +94,7 @@ CurlRequest::FreeEasy() if (!easy) return; - if (registered) - Stop(); + Stop(); easy = nullptr; }