From 6b2bcbab231a4fa61434f34c933d5f1fa21bb4d3 Mon Sep 17 00:00:00 2001 From: pengxuanzheng Date: Fri, 23 Oct 2020 15:05:47 +0800 Subject: 增加hos_init_api、hos_shutdown_api 接口 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hos_client.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/hos_client.cpp') diff --git a/src/hos_client.cpp b/src/hos_client.cpp index 8879a8c6..290c4311 100644 --- a/src/hos_client.cpp +++ b/src/hos_client.cpp @@ -50,6 +50,7 @@ typedef struct hos_client_handle_s hos_info_t *hash_hos_info[MAX_HOS_CLIENT_THREAD_NUM]; size_t fd_info[MAX_HOS_CLIENT_THREAD_NUM][MAX_HOS_CLIENT_FD_NUM]; +Aws::SDKOptions options; static size_t hash_get_min_free_fd(size_t thread_id) { @@ -115,6 +116,18 @@ void set_thread_sum(hos_client_handle client, size_t thread_sum) return ; } +void hos_init_api() +{ + //options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; + Aws::InitAPI(options); +} + +void hos_shutdown_api() +{ + //options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; + Aws::ShutdownAPI(options); +} + hos_client_handle hos_client_create(const char *endpoint, const char *accesskeyid, const char *secretkey, size_t pool_size) { if (!endpoint || !accesskeyid || !secretkey) @@ -122,9 +135,6 @@ hos_client_handle hos_client_create(const char *endpoint, const char *accesskeyi return NULL; } - Aws::SDKOptions options; - //options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; - Aws::InitAPI(options); hos_client_handle handle = (hos_client_handle)malloc(sizeof(hos_client_handle_t)); memset(handle, 0, sizeof(hos_client_handle_t)); @@ -547,7 +557,6 @@ int hos_client_destory(hos_client_handle handle) delete handle->S3Client; Aws::Vector().swap(handle->buckets); - Aws::ShutdownAPI((handle->options)); for (i = 0; i < handle->thread_sum; i++) { -- cgit v1.2.3