use libfastcommon V1.56

use_libfastcommon1.56
YuQing 2022-02-25 15:13:09 +08:00
parent 9d34ec5679
commit e8c8f3d6ac
6 changed files with 24 additions and 20 deletions

View File

@ -1,4 +1,8 @@
Version 6.08 2022-02-25
* use libfastcommon V1.56
NOTE: you MUST upgrade libfastcommon to V1.56 or later
Version 6.07 2020-12-31 Version 6.07 2020-12-31
* use libfastcommon V1.44 * use libfastcommon V1.44
NOTE: you MUST upgrade libfastcommon to V1.44 or later NOTE: you MUST upgrade libfastcommon to V1.44 or later

View File

@ -23,7 +23,7 @@
int g_fdfs_connect_timeout = DEFAULT_CONNECT_TIMEOUT; int g_fdfs_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
int g_fdfs_network_timeout = DEFAULT_NETWORK_TIMEOUT; int g_fdfs_network_timeout = DEFAULT_NETWORK_TIMEOUT;
char g_fdfs_base_path[MAX_PATH_SIZE] = {'/', 't', 'm', 'p', '\0'}; char g_fdfs_base_path[MAX_PATH_SIZE] = {'/', 't', 'm', 'p', '\0'};
Version g_fdfs_version = {6, 7}; Version g_fdfs_version = {6, 8};
bool g_use_connection_pool = false; bool g_use_connection_pool = false;
ConnectionPool g_connection_pool; ConnectionPool g_connection_pool;
int g_connection_pool_max_idle_time = 3600; int g_connection_pool_max_idle_time = 3600;

View File

@ -72,7 +72,7 @@ int fdfs_http_get_content_type_by_extname(FDFSHTTPParams *pParams, \
return 0; return 0;
} }
pHashData = hash_find_ex(&pParams->content_type_hash, \ pHashData = fc_hash_find_ex(&pParams->content_type_hash, \
ext_name, ext_len + 1); ext_name, ext_len + 1);
if (pHashData == NULL) if (pHashData == NULL)
{ {
@ -282,7 +282,7 @@ int fdfs_http_params_load(IniContext *pIniContext, \
if (!(pParams->need_find_content_type || pParams->support_multi_range)) if (!(pParams->need_find_content_type || pParams->support_multi_range))
{ {
hash_destroy(&pParams->content_type_hash); fc_hash_destroy(&pParams->content_type_hash);
} }
if ((result=getFileContent(token_check_fail_filename, \ if ((result=getFileContent(token_check_fail_filename, \
@ -301,7 +301,7 @@ void fdfs_http_params_destroy(FDFSHTTPParams *pParams)
{ {
if (!(pParams->need_find_content_type || pParams->support_multi_range)) if (!(pParams->need_find_content_type || pParams->support_multi_range))
{ {
hash_destroy(&pParams->content_type_hash); fc_hash_destroy(&pParams->content_type_hash);
} }
} }

View File

@ -69,11 +69,11 @@ int load_mime_types_from_file(HashArray *pHash, const char *mime_filename)
} }
} }
if ((result=hash_init_ex(pHash, PJWHash, 2 * 1024, 0.75, 0, true)) != 0) if ((result=fc_hash_init_ex(pHash, PJWHash, 2 * 1024, 0.75, 0, true)) != 0)
{ {
free(content); free(content);
logError("file: "__FILE__", line: %d, " \ logError("file: "__FILE__", line: %d, " \
"hash_init_ex fail, errno: %d, error info: %s", \ "fc_hash_init_ex fail, errno: %d, error info: %s", \
__LINE__, result, STRERROR(result)); __LINE__, result, STRERROR(result));
return result; return result;
} }
@ -108,14 +108,14 @@ int load_mime_types_from_file(HashArray *pHash, const char *mime_filename)
continue; continue;
} }
if ((result=hash_insert_ex(pHash, ext_name, \ if ((result=fc_hash_insert_ex(pHash, ext_name, \
strlen(ext_name)+1, content_type, \ strlen(ext_name)+1, content_type, \
strlen(content_type)+1, true)) < 0) strlen(content_type)+1, true)) < 0)
{ {
free(content); free(content);
result *= -1; result *= -1;
logError("file: "__FILE__", line: %d, " \ logError("file: "__FILE__", line: %d, " \
"hash_insert_ex fail, errno: %d, " \ "fc_hash_insert_ex fail, errno: %d, " \
"error info: %s", __LINE__, \ "error info: %s", __LINE__, \
result, STRERROR(result)); result, STRERROR(result));
return result; return result;
@ -125,7 +125,7 @@ int load_mime_types_from_file(HashArray *pHash, const char *mime_filename)
free(content); free(content);
//hash_stat_print(pHash); //fc_hash_stat_print(pHash);
return 0; return 0;
} }

View File

@ -338,7 +338,7 @@ int fdfs_load_storage_ids(char *content, const char *pStorageIdsFilename)
g_storage_ids_by_id.count = 0; g_storage_ids_by_id.count = 0;
for (i=0; i<line_count; i++) for (i=0; i<line_count; i++)
{ {
trim(lines[i]); fc_trim(lines[i]);
if (*lines[i] == '\0' || *lines[i] == '#') if (*lines[i] == '\0' || *lines[i] == '#')
{ {
continue; continue;

View File

@ -495,7 +495,7 @@ static int tracker_load_groups_old(FDFSGroups *pGroups, const char *data_path)
memset(&clientInfo, 0, sizeof(TrackerClientInfo)); memset(&clientInfo, 0, sizeof(TrackerClientInfo));
snprintf(group_name, sizeof(group_name),\ snprintf(group_name, sizeof(group_name),\
"%s", trim(fields[0])); "%s", fc_trim(fields[0]));
if ((result=tracker_mem_add_group_ex(pGroups, &clientInfo, \ if ((result=tracker_mem_add_group_ex(pGroups, &clientInfo, \
group_name, false, &bInserted)) != 0) group_name, false, &bInserted)) != 0)
{ {
@ -514,7 +514,7 @@ static int tracker_load_groups_old(FDFSGroups *pGroups, const char *data_path)
break; break;
} }
clientInfo.pGroup->storage_port = atoi(trim(fields[1])); clientInfo.pGroup->storage_port = atoi(fc_trim(fields[1]));
if (col_count == STORAGE_DATA_GROUP_FIELDS - 2) if (col_count == STORAGE_DATA_GROUP_FIELDS - 2)
{ //version < V1.12 { //version < V1.12
clientInfo.pGroup->store_path_count = 0; clientInfo.pGroup->store_path_count = 0;
@ -523,9 +523,9 @@ static int tracker_load_groups_old(FDFSGroups *pGroups, const char *data_path)
else else
{ {
clientInfo.pGroup->store_path_count = \ clientInfo.pGroup->store_path_count = \
atoi(trim(fields[2])); atoi(fc_trim(fields[2]));
clientInfo.pGroup->subdir_count_per_path = \ clientInfo.pGroup->subdir_count_per_path = \
atoi(trim(fields[3])); atoi(fc_trim(fields[3]));
} }
} }
@ -907,8 +907,8 @@ static int tracker_load_storages_old(FDFSGroups *pGroups, const char *data_path)
} }
memset(&clientInfo, 0, sizeof(TrackerClientInfo)); memset(&clientInfo, 0, sizeof(TrackerClientInfo));
snprintf(group_name, sizeof(group_name), "%s", trim(fields[0])); snprintf(group_name, sizeof(group_name), "%s", fc_trim(fields[0]));
snprintf(ip_addr, sizeof(ip_addr), "%s", trim(fields[1])); snprintf(ip_addr, sizeof(ip_addr), "%s", fc_trim(fields[1]));
if ((clientInfo.pGroup=tracker_mem_get_group_ex(pGroups, \ if ((clientInfo.pGroup=tracker_mem_get_group_ex(pGroups, \
group_name)) == NULL) group_name)) == NULL)
{ {
@ -952,7 +952,7 @@ static int tracker_load_storages_old(FDFSGroups *pGroups, const char *data_path)
FDFS_STORAGE_STATUS_OFFLINE; FDFS_STORAGE_STATUS_OFFLINE;
} }
psync_src_id = trim(fields[3]); psync_src_id = fc_trim(fields[3]);
pStorage->sync_until_timestamp = atoi( \ pStorage->sync_until_timestamp = atoi( \
trim_left(fields[4])); trim_left(fields[4]));
pStorage->stat.total_upload_count = strtoll( \ pStorage->stat.total_upload_count = strtoll( \
@ -1007,7 +1007,7 @@ static int tracker_load_storages_old(FDFSGroups *pGroups, const char *data_path)
snprintf(pStorage->version, \ snprintf(pStorage->version, \
sizeof(pStorage->version), sizeof(pStorage->version),
"%s", trim(fields[21])); "%s", fc_trim(fields[21]));
} }
} }
} }
@ -1420,9 +1420,9 @@ static int tracker_load_sync_timestamps(FDFSGroups *pGroups, const char *data_pa
} }
snprintf(group_name, sizeof(group_name), \ snprintf(group_name, sizeof(group_name), \
"%s", trim(fields[0])); "%s", fc_trim(fields[0]));
snprintf(src_storage_id, sizeof(src_storage_id), \ snprintf(src_storage_id, sizeof(src_storage_id), \
"%s", trim(fields[1])); "%s", fc_trim(fields[1]));
if (strcmp(group_name, previous_group_name) != 0 || \ if (strcmp(group_name, previous_group_name) != 0 || \
pGroup == NULL) pGroup == NULL)
{ {