explicit StoreDestructor(RGWRados *_s) : store(_s) {}
~StoreDestructor() {
RGWStoreManager::close_storage(store);
+ rgw_http_client_cleanup();
}
};
rgw_bucket_init(store->meta_mgr);
rgw_otp_init(store);
+ rgw_http_client_init(g_ceph_context);
struct rgw_curl_setup {
rgw_curl_setup() {
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_rgw
+RGWHTTPManager *rgw_http_manager;
+
struct rgw_http_req_data : public RefCountedObject {
CURL *easy_handle{nullptr};
curl_slist *h{nullptr};
return 0;
}
+void rgw_http_client_init(CephContext *cct)
+{
+ curl_global_init(CURL_GLOBAL_ALL);
+ rgw_http_manager = new RGWHTTPManager(cct);
+ rgw_http_manager->set_threaded();
+}
+
+void rgw_http_client_cleanup()
+{
+ rgw_http_manager->stop();
+ delete rgw_http_manager;
+ curl_global_cleanup();
+}
+
+
+int RGWHTTP::send(RGWHTTPClient *req) {
+ if (!req) {
+ return 0;
+ }
+ int r = rgw_http_manager->add_request(req);
+ if (r < 0) {
+ return r;
+ }
+
+ return 0;
+}
+
+int RGWHTTP::process(RGWHTTPClient *req) {
+ if (!req) {
+ return 0;
+ }
+ int r = send(req);
+ if (r < 0) {
+ return r;
+ }
+
+ return req->wait();
+}
using param_pair_t = pair<string, string>;
using param_vec_t = vector<param_pair_t>;
+void rgw_http_client_init(CephContext *cct);
+void rgw_http_client_cleanup();
+
struct rgw_http_req_data;
class RGWHTTPManager;
int complete_requests();
};
+class RGWHTTP
+{
+public:
+ static int send(RGWHTTPClient *req);
+ static int process(RGWHTTPClient *req);
+};
#endif
rgw_init_resolver();
rgw::curl::setup_curl(fe_map);
-
+ rgw_http_client_init(g_ceph_context);
+
#if defined(WITH_RADOSGW_FCGI_FRONTEND)
FCGX_Init();
#endif
rgw::auth::s3::LDAPEngine::shutdown();
rgw_tools_cleanup();
rgw_shutdown_resolver();
+ rgw_http_client_cleanup();
rgw::curl::cleanup_curl();
rgw_perf_stop(g_ceph_context);