]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: cr_rest: allow a error type for wait with bufferlists
authorAbhishek Lekshmanan <abhishek@suse.com>
Thu, 18 Apr 2019 14:44:10 +0000 (16:44 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 25 Apr 2019 12:38:52 +0000 (14:38 +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>
src/rgw/rgw_rest_conn.h

index af4ad0c07c754d67099ccaf6cc05d878d34e84f9..2ca4fe90df629799af71b7051987147b6cd38c2c 100644 (file)
@@ -422,27 +422,19 @@ public:
     return req.get_http_status();
   }
 
-  template <class E = std::nullptr_t>
+  template <class E = int>
   int wait(bufferlist *pbl, optional_yield y, E *err_result = nullptr) {
     int ret = req.wait(y);
     *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 = std::nullptr_t>
+  template <class T, class E = int>
   int wait(T *dest, optional_yield y, E *err_result = nullptr);
 };
 
@@ -450,17 +442,15 @@ template <class T, class E>
 int RGWRESTSendResource::wait(T *dest, optional_yield y, E *err_result)
 {
   int ret = req.wait(y);
-  if (ret >=0) {
+  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;
   }