diff --git a/cache/src/tango_cache_client.cpp b/cache/src/tango_cache_client.cpp index 394a7af..baf58dc 100644 --- a/cache/src/tango_cache_client.cpp +++ b/cache/src/tango_cache_client.cpp @@ -770,6 +770,8 @@ struct tango_cache_instance *tango_cache_instance_new(struct event_base* evbase, instance = (struct tango_cache_instance *)malloc(sizeof(struct tango_cache_instance)); memset(instance, 0, sizeof(struct tango_cache_instance)); + instance->runtime_log = runtimelog; + instance->evbase = evbase; if(load_local_configure(instance, profile_path, section)) { @@ -782,10 +784,7 @@ struct tango_cache_instance *tango_cache_instance_new(struct event_base* evbase, return NULL; } - instance->evbase = evbase; instance->multi_hd = curl_multi_init(); - instance->runtime_log = runtimelog; - curl_multi_setopt(instance->multi_hd, CURLMOPT_PIPELINING, CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX); curl_multi_setopt(instance->multi_hd, CURLMOPT_MAX_HOST_CONNECTIONS, instance->max_cnn_host); curl_multi_setopt(instance->multi_hd, CURLMOPT_SOCKETFUNCTION, curl_socket_function_cb); diff --git a/cache/src/tango_cache_tools.h b/cache/src/tango_cache_tools.h index 6cac7b8..e0ab730 100644 --- a/cache/src/tango_cache_tools.h +++ b/cache/src/tango_cache_tools.h @@ -7,7 +7,7 @@ MESA_handle_runtime_log((handle), (lv), "TANGO_CACHE", "%s:%d, " fmt, __FILE__, __LINE__, ##args) #ifdef CACHE_DEBUG_SWITCH -#define DBG_CACHE(msg...) do{printf(msg);}while(0) +#define DBG_CACHE(fmt, args...) do{printf("%s():%d, " fmt, __FUNCTION__, __LINE__, ##args);}while(0) #else #define DBG_CACHE(msg...) #endif diff --git a/cache/src/tango_cache_transfer.cpp b/cache/src/tango_cache_transfer.cpp index 5fb6398..1889341 100644 --- a/cache/src/tango_cache_transfer.cpp +++ b/cache/src/tango_cache_transfer.cpp @@ -138,7 +138,7 @@ static int http_put_bodypart_request_evbuf(struct tango_cache_ctx *ctx, bool ful rc = curl_multi_add_handle(ctx->instance->multi_hd, ctx->curl); assert(rc==CURLM_OK); - DBG_CACHE("http_put_bodypart_request_evbuf, state: %d, length: %lu, key: %s\n", ctx->put.state, ctx->put.upload_length, ctx->object_key); + DBG_CACHE("state: %d, length: %lu, key: %s\n", ctx->put.state, ctx->put.upload_length, ctx->object_key); return 1; } @@ -197,7 +197,7 @@ int curl_get_minio_uploadID(struct tango_cache_ctx *ctx) rc = curl_multi_add_handle(ctx->instance->multi_hd, ctx->curl); assert(rc==CURLM_OK); - DBG_CACHE("curl_get_minio_uploadID, state: %d, key: %s\n", ctx->put.state, ctx->object_key); + DBG_CACHE("state: %d, key: %s\n", ctx->put.state, ctx->object_key); return 1; } @@ -295,7 +295,7 @@ bool cache_kick_combine_minio(struct tango_cache_ctx *ctx) rc = curl_multi_add_handle(ctx->instance->multi_hd, ctx->curl); assert(rc==CURLM_OK); - DBG_CACHE("cache_kick_combine_minio, state: %d, key: %s\n", ctx->put.state, ctx->object_key); + DBG_CACHE("state: %d, key: %s\n", ctx->put.state, ctx->object_key); return true; } @@ -357,7 +357,7 @@ int cache_kick_upload_minio_end(struct tango_cache_ctx *ctx) { int ret = 0; - DBG_CACHE("cache_kick_upload_minio_end, state: %d, key: %s\n", ctx->put.state, ctx->object_key); + DBG_CACHE("state: %d, key: %s, curl %s NULL\n", ctx->put.state, ctx->object_key, (ctx->curl==NULL)?"is":"is not"); ctx->put.close_state = true;//仅设置状态,并非真正关闭;内部状态机轮转结束后再关闭 if(ctx->fail_state) { @@ -416,7 +416,7 @@ int cache_kick_upload_minio_end(struct tango_cache_ctx *ctx) void tango_cache_curl_put_done(struct tango_cache_ctx *ctx, CURLcode res, long res_code) { - DBG_CACHE("tango_cache_curl_put_done, state: %d, key: %s\n", ctx->put.state, ctx->object_key); + DBG_CACHE("state: %d, key: %s\n", ctx->put.state, ctx->object_key); switch(ctx->put.state) { case PUT_STATE_WAIT_START: