]> git-server-git.apps.pok.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>
Mon, 12 Sep 2016 15:26:03 +0000 (11:26 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_http_client.cc

index 60fe615f30715887d279001f80e9ffc826552f47..97e146b78dbbc76c967d7670d33f927b6740b501 100644 (file)
@@ -418,6 +418,16 @@ int RGWHTTPTransceiver::send_data(void* ptr, size_t len)
 }
 
 
+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)
@@ -436,10 +446,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;
     }
@@ -491,10 +499,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;
     }