]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWHTTPManager, can call stop() more than once
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 3 May 2016 17:02:02 +0000 (10:02 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 9 May 2016 21:36:40 +0000 (14:36 -0700)
destructor calls stop(), but it can be also called explicitly, if caller
wants to ensure requests are not being handled anymore.

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

index 56540d95ea0f764e6ad53d4925092e0adceb5150..80f3e4e131445461c6f2407ab6943f23c943ce3c 100644 (file)
@@ -562,6 +562,12 @@ int RGWHTTPManager::set_threaded()
 
 void RGWHTTPManager::stop()
 {
+  if (is_stopped.read()) {
+    return;
+  }
+
+  is_stopped.set(1);
+
   if (is_threaded) {
     going_down.set(1);
     signal_thread();
index c31af9fa7da33d254511e1d3d6ea3c79743f4888..1d69cedfe39f6f5580d1f831be07f66430fc003c 100644 (file)
@@ -110,6 +110,7 @@ class RGWHTTPManager {
   void *multi_handle;
   bool is_threaded;
   atomic_t going_down;
+  atomic_t is_stopped;
 
   RWLock reqs_lock;
   map<uint64_t, rgw_http_req_data *> reqs;