|
|
@@ -3,6 +3,7 @@
|
|
|
#include "cos_api.h"
|
|
|
#include "cos_http_io.h"
|
|
|
#include "cos_log.h"
|
|
|
+static int inited = 0;
|
|
|
extern "C" {
|
|
|
#ifdef _WIN32
|
|
|
DLL_EXPORT
|
|
|
@@ -17,14 +18,18 @@ extern "C" {
|
|
|
|
|
|
module::tencent_cos::tencent_cos()
|
|
|
{
|
|
|
- if (cos_http_io_initialize(NULL, 0) != COSE_OK) {
|
|
|
- printf("COS HTTP INIT FAILED");
|
|
|
+ if(inited == 0){
|
|
|
+ if (cos_http_io_initialize(NULL, 0) != COSE_OK) {
|
|
|
+ printf("COS HTTP INIT FAILED");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ inited = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
module::tencent_cos::~tencent_cos()
|
|
|
{
|
|
|
- cos_http_io_deinitialize();
|
|
|
+ // cos_http_io_deinitialize();
|
|
|
}
|
|
|
|
|
|
std::string module::tencent_cos::upfile(const std::string& appid,const std::string& endpoint,const std::string& access_key_id,const std::string& access_key_secret,const std::string& bucket_name,const std::string& object_name,const std::string& filepath)
|