diff --git a/Makefile b/Makefile index 711073f94..2ca09655a 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ K ?= K.sh MAJOR = 0 MINOR = 4 PATCH = 13 -BUILD = 45 +BUILD = 46 SOURCE := $(notdir $(wildcard src/bin/*)) CARCH = x86_64-linux-gnu \ arm-linux-gnueabihf \ diff --git a/src/lib/Krypto.ninja-apis.h b/src/lib/Krypto.ninja-apis.h index 063f1020c..843a3b862 100644 --- a/src/lib/Krypto.ninja-apis.h +++ b/src/lib/Krypto.ninja-apis.h @@ -155,7 +155,7 @@ namespace ₿ { static const json xfer(const string &url, const long &timeout = 13) { return perform(url, [&](CURL *curl) { curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); - }, timeout == 13); + }); }; static const json xfer(const string &url, const string &post) { return perform(url, [&](CURL *curl) { @@ -165,7 +165,7 @@ namespace ₿ { curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post.data()); }); }; - static const json perform(const string &url, const function custom_setopt, const bool debug = true) { + static const json perform(const string &url, const function custom_setopt) { static mutex waiting_reply; lock_guard lock(waiting_reply); string reply; @@ -180,12 +180,14 @@ namespace ₿ { res = curl_easy_perform(curl); curl_easy_cleanup(curl); } - return (debug and res != CURLE_OK) - ? (json){ {"error", string("CURL Error: ") + curl_easy_strerror(res)} } - : (json::accept(reply) + return res == CURLE_OK + ? (json::accept(reply) ? json::parse(reply) : json::object() - ); + ) + : (json){ + {"error", string("CURL Error: ") + curl_easy_strerror(res)} + }; }; private: static size_t write(void *buf, size_t size, size_t nmemb, void *reply) {