]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: cr_rest: allow a error type for wait with bufferlists 28064/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Thu, 18 Apr 2019 14:44:10 +0000 (16:44 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Mon, 13 May 2019 11:34:36 +0000 (13:34 +0200)
This is the version that will not apply json decoding if the type is a
bufferlist

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 8a7044d0c1716b9df321bb7c94278f719a25a67c)

Conflicts:
src/rgw/rgw_rest_conn.h
conflicts due to optional_yield_context in master

src/rgw/rgw_rest_conn.h

index 1b45d6e5305b2fb7c3be7a28cbe5e2365c0d96d6..82047d24e5770f6ae2444a84391a6aea4c921cc4 100644 (file)
@@ -422,45 +422,35 @@ public:
     return req.get_http_status();
   }
 
-  template <class E = std::nullptr_t>
+  template <class E = int>
   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<E, std::nullptr_t>) {
-        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 <class T, class E = int>
   int wait(T *dest, E *err_result = nullptr);
 };
 
-template <class T, class E=std::nullptr_t>
-int RGWRESTSendResource::wait(T *dest, optional_yield y, E *err_result)
+template <class T, class E=int>
+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<E, std::nullptr_t>) {
-    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;
   }