]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: factored clear_signal out of do_curl_wait
authorCasey Bodley <cbodley@redhat.com>
Fri, 9 Sep 2016 19:58:50 +0000 (15:58 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 9 Nov 2016 15:29:21 +0000 (10:29 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit f2f5cdf3aadfa265e2e834a9354c2aacf274212d)

src/rgw/rgw_http_client.cc

index 52e0eec7a2a5279f3ee6142d8f651a0559921756..04ffd18a2feb2b2f80adb217045f6b373842ab48 100644 (file)
@@ -344,6 +344,16 @@ RGWHTTPClient::~RGWHTTPClient()
 }
 
 
+static int clear_signal(int fd)
+{
+  uint32_t buf;
+  int ret = ::read(fd, (void *)&buf, sizeof(buf));
+  if (ret < 0) {
+    return -errno;
+  }
+  return 0;
+}
+
 #if HAVE_CURL_MULTI_WAIT
 
 static int do_curl_wait(CephContext *cct, CURLM *handle, int signal_fd)
@@ -362,10 +372,8 @@ static int do_curl_wait(CephContext *cct, CURLM *handle, int signal_fd)
   }
 
   if (wait_fd.revents > 0) {
-    uint32_t buf;
-    ret = read(signal_fd, (void *)&buf, sizeof(buf));
+    ret = clear_signal(signal_fd);
     if (ret < 0) {
-      ret = -errno;
       ldout(cct, 0) << "ERROR: " << __func__ << "(): read() returned " << ret << dendl;
       return ret;
     }
@@ -417,10 +425,8 @@ static int do_curl_wait(CephContext *cct, CURLM *handle, int signal_fd)
   }
 
   if (signal_fd > 0 && FD_ISSET(signal_fd, &fdread)) {
-    uint32_t buf;
-    ret = read(signal_fd, (void *)&buf, sizeof(buf));
+    ret = clear_signal(signal_fd);
     if (ret < 0) {
-      ret = -errno;
       ldout(cct, 0) << "ERROR: " << __func__ << "(): read() returned " << ret << dendl;
       return ret;
     }