From: Abhishek Lekshmanan Date: Thu, 18 Apr 2019 14:44:10 +0000 (+0200) Subject: rgw: cr_rest: allow a error type for wait with bufferlists X-Git-Tag: v14.2.2~136^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=16aacb8a7ffeef7a22e4c654dc6a5475d606080d;p=ceph.git rgw: cr_rest: allow a error type for wait with bufferlists This is the version that will not apply json decoding if the type is a bufferlist Signed-off-by: Abhishek Lekshmanan (cherry picked from commit 8a7044d0c1716b9df321bb7c94278f719a25a67c) Conflicts: src/rgw/rgw_rest_conn.h conflicts due to optional_yield_context in master --- diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h index 1b45d6e5305b2..82047d24e5770 100644 --- a/src/rgw/rgw_rest_conn.h +++ b/src/rgw/rgw_rest_conn.h @@ -422,45 +422,35 @@ public: return req.get_http_status(); } - template + template int wait(bufferlist *pbl, E *err_result = nullptr) { - int ret = req.wait(y); + int ret = req.wait(); *pbl = bl; - if (ret >=0) { - ret = req.get_status(); - } - - if (ret < 0) { - if constexpr (!std::is_same_v) { - if (err_result) { - ret = parse_decode_json(*err_result, bl); - } - } + if (ret < 0 && err_result ) { + ret = parse_decode_json(*err_result, bl); } - return ret; + return req.get_status(); } template int wait(T *dest, E *err_result = nullptr); }; -template -int RGWRESTSendResource::wait(T *dest, optional_yield y, E *err_result) +template +int RGWRESTSendResource::wait(T *dest, E *err_result) { - int ret = req.wait(y); - if (ret >=0) { + int ret = req.wait(); + if (ret >= 0) { ret = req.get_status(); } - if constexpr (!std::is_same_v) { - if (ret <0 && err_result) { - ret = parse_decode_json(*err_result, bl); - } + if (ret < 0 && err_result) { + ret = parse_decode_json(*err_result, bl); } - if (ret < 0){ + if (ret < 0) { return ret; }