use libfastcommon V1.44

pull/484/head
YuQing 2020-09-08 16:36:29 +08:00
parent 4aff731fd5
commit b5534f9c8f
7 changed files with 16 additions and 19 deletions

View File

@ -1,4 +1,8 @@
Version 6.07 2020-09-08
* use libfastcommon V1.44
NOTE: you MUST upgrade libfastcommon to V1.44 or later
Version 6.06 2019-12-30 Version 6.06 2019-12-30
* bugfixed: fdfs_storaged can't quit normally * bugfixed: fdfs_storaged can't quit normally
* bugfixed: init/memset return ip address to ascii 0 for Java SDK * bugfixed: init/memset return ip address to ascii 0 for Java SDK

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, 6}; Version g_fdfs_version = {6, 7};
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

@ -24,6 +24,7 @@
#include "fastcommon/pthread_func.h" #include "fastcommon/pthread_func.h"
#include "fastcommon/logger.h" #include "fastcommon/logger.h"
#include "fastcommon/sockopt.h" #include "fastcommon/sockopt.h"
#include "fastcommon/ioevent_loop.h"
#include "storage_dio.h" #include "storage_dio.h"
#include "storage_nio.h" #include "storage_nio.h"
#include "storage_service.h" #include "storage_service.h"
@ -156,7 +157,7 @@ int storage_dio_queue_push(struct fast_task_info *pTask)
pClientInfo->stage |= FDFS_STORAGE_STAGE_DIO_THREAD; pClientInfo->stage |= FDFS_STORAGE_STAGE_DIO_THREAD;
if ((result=blocked_queue_push(&(pContext->queue), pTask)) != 0) if ((result=blocked_queue_push(&(pContext->queue), pTask)) != 0)
{ {
add_to_deleted_list(pTask); iovent_add_to_deleted_list(pTask);
return result; return result;
} }

View File

@ -38,13 +38,6 @@ static void client_sock_read(int sock, short event, void *arg);
static void client_sock_write(int sock, short event, void *arg); static void client_sock_write(int sock, short event, void *arg);
static int storage_nio_init(struct fast_task_info *pTask); static int storage_nio_init(struct fast_task_info *pTask);
void add_to_deleted_list(struct fast_task_info *pTask)
{
((StorageClientInfo *)pTask->arg)->canceled = true;
pTask->next = pTask->thread_data->deleted_list;
pTask->thread_data->deleted_list = pTask;
}
void task_finish_clean_up(struct fast_task_info *pTask) void task_finish_clean_up(struct fast_task_info *pTask)
{ {
StorageClientInfo *pClientInfo; StorageClientInfo *pClientInfo;
@ -66,6 +59,7 @@ void task_finish_clean_up(struct fast_task_info *pTask)
pTask->event.timer.expires = 0; pTask->event.timer.expires = 0;
} }
pTask->canceled = false;
memset(pTask->arg, 0, sizeof(StorageClientInfo)); memset(pTask->arg, 0, sizeof(StorageClientInfo));
free_queue_push(pTask); free_queue_push(pTask);
@ -87,7 +81,7 @@ static int set_recv_event(struct fast_task_info *pTask)
pTask->event.fd, IOEVENT_READ, pTask) != 0) pTask->event.fd, IOEVENT_READ, pTask) != 0)
{ {
result = errno != 0 ? errno : ENOENT; result = errno != 0 ? errno : ENOENT;
add_to_deleted_list(pTask); iovent_add_to_deleted_list(pTask);
logError("file: "__FILE__", line: %d, "\ logError("file: "__FILE__", line: %d, "\
"ioevent_modify fail, " \ "ioevent_modify fail, " \
@ -112,7 +106,7 @@ static int set_send_event(struct fast_task_info *pTask)
pTask->event.fd, IOEVENT_WRITE, pTask) != 0) pTask->event.fd, IOEVENT_WRITE, pTask) != 0)
{ {
result = errno != 0 ? errno : ENOENT; result = errno != 0 ? errno : ENOENT;
add_to_deleted_list(pTask); iovent_add_to_deleted_list(pTask);
logError("file: "__FILE__", line: %d, "\ logError("file: "__FILE__", line: %d, "\
"ioevent_modify fail, " \ "ioevent_modify fail, " \
@ -210,7 +204,7 @@ void storage_recv_notify_read(int sock, short event, void *arg)
if (result != 0) if (result != 0)
{ {
add_to_deleted_list(pTask); iovent_add_to_deleted_list(pTask);
} }
} }
} }
@ -248,7 +242,7 @@ static void client_sock_read(int sock, short event, void *arg)
pTask = (struct fast_task_info *)arg; pTask = (struct fast_task_info *)arg;
pClientInfo = (StorageClientInfo *)pTask->arg; pClientInfo = (StorageClientInfo *)pTask->arg;
if (pClientInfo->canceled) if (pTask->canceled)
{ {
return; return;
} }
@ -437,7 +431,7 @@ static void client_sock_write(int sock, short event, void *arg)
pTask = (struct fast_task_info *)arg; pTask = (struct fast_task_info *)arg;
pClientInfo = (StorageClientInfo *)pTask->arg; pClientInfo = (StorageClientInfo *)pTask->arg;
if (pClientInfo->canceled) if (pTask->canceled)
{ {
return; return;
} }

View File

@ -121,7 +121,6 @@ typedef struct
typedef struct typedef struct
{ {
int nio_thread_index; //nio thread index int nio_thread_index; //nio thread index
bool canceled;
char stage; //nio stage, send or recv char stage; //nio stage, send or recv
char storage_server_id[FDFS_STORAGE_ID_MAX_SIZE]; char storage_server_id[FDFS_STORAGE_ID_MAX_SIZE];
@ -152,7 +151,6 @@ void storage_recv_notify_read(int sock, short event, void *arg);
int storage_send_add_event(struct fast_task_info *pTask); int storage_send_add_event(struct fast_task_info *pTask);
void task_finish_clean_up(struct fast_task_info *pTask); void task_finish_clean_up(struct fast_task_info *pTask);
void add_to_deleted_list(struct fast_task_info *pTask);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -8434,7 +8434,7 @@ int storage_deal_task(struct fast_task_info *pTask)
result = storage_server_fetch_one_path_binlog(pTask); result = storage_server_fetch_one_path_binlog(pTask);
break; break;
case FDFS_PROTO_CMD_QUIT: case FDFS_PROTO_CMD_QUIT:
add_to_deleted_list(pTask); iovent_add_to_deleted_list(pTask);
return 0; return 0;
case FDFS_PROTO_CMD_ACTIVE_TEST: case FDFS_PROTO_CMD_ACTIVE_TEST:
result = storage_deal_active_test(pTask); result = storage_deal_active_test(pTask);

View File

@ -84,8 +84,8 @@ void storage_sync_connect_storage_server_ex(const FDFSStorageBrief *pStorage,
{ {
strcpy(conn->ip_addr, ip_addrs.ips[i].address); strcpy(conn->ip_addr, ip_addrs.ips[i].address);
conn->sock = socketCreateExAuto(conn->ip_addr, conn->sock = socketCreateExAuto(conn->ip_addr,
g_fdfs_connect_timeout, O_NONBLOCK, O_NONBLOCK, g_client_bind_addr ?
g_client_bind_addr ? g_bind_addr : NULL, &result); g_bind_addr : NULL, &result);
if (conn->sock < 0) if (conn->sock < 0)
{ {
logCrit("file: "__FILE__", line: %d, " logCrit("file: "__FILE__", line: %d, "