]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix do_curl_wait() if curl_multi_wait() not defined
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 15 Jan 2016 18:39:09 +0000 (10:39 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:56 +0000 (16:13 -0800)
needed for older systems

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_http_client.cc

index 1c241ba43d13a988b7e6dc0d39e25469432e81ce..c233d93a1d7042a48254f41e9b14115620fa16d0 100644 (file)
@@ -281,7 +281,7 @@ static int do_curl_wait(CephContext *cct, CURLM *handle, int signal_fd)
 
 #else
 
-static int do_curl_wait(CephContext *cct, CURLM *handle)
+static int do_curl_wait(CephContext *cct, CURLM *handle, int signal_fd)
 {
   fd_set fdread;
   fd_set fdwrite;
@@ -295,10 +295,14 @@ static int do_curl_wait(CephContext *cct, CURLM *handle)
   /* get file descriptors from the transfers */ 
   int ret = curl_multi_fdset(handle, &fdread, &fdwrite, &fdexcep, &maxfd);
   if (ret) {
-    dout(0) << "ERROR: curl_multi_fdset returned " << ret << dendl;
+    generic_dout(0) << "ERROR: curl_multi_fdset returned " << ret << dendl;
     return -EIO;
   }
 
+  if (signal_fd >= maxfd) {
+    maxfd = signal_fd + 1;
+  }
+
   /* forcing a strict timeout, as the returned fdsets might not reference all fds we wait on */
   uint64_t to = cct->_conf->rgw_curl_wait_timeout_ms;
 #define RGW_CURL_TIMEOUT 1000
@@ -315,11 +319,20 @@ static int do_curl_wait(CephContext *cct, CURLM *handle)
     return ret;
   }
 
+  if (signal_fd > 0 && FD_ISSET(signal_fd, &fdread)) {
+    uint32_t buf;
+    ret = read(signal_fd, (void *)&buf, sizeof(buf));
+    if (ret < 0) {
+      ret = -errno;
+      dout(0) << "ERROR: " << __func__ << "(): read() returned " << ret << dendl;
+      return ret;
+    }
+  }
+
   return 0;
 }
 
 #endif
-#warning need to fix do_curl_wait() in second case
 
 void *RGWHTTPManager::ReqsThread::entry()
 {