use epoll edge trigger to resolve github issues #608

pull/616/head
YuQing 2023-02-12 10:49:10 +08:00
parent 7414bea9b5
commit 1e209da4e2
3 changed files with 5 additions and 2 deletions

View File

@ -20,7 +20,7 @@
#include "fastcommon/logger.h"
#include "fdfs_global.h"
Version g_fdfs_version = {6, 9, 3};
Version g_fdfs_version = {6, 9, 4};
bool g_use_connection_pool = false;
ConnectionPool g_connection_pool;
int g_connection_pool_max_idle_time = 3600;

View File

@ -1648,6 +1648,7 @@ int storage_service_init()
return result;
}
SF_G_EPOLL_EDGE_TRIGGER = true;
result = sf_service_init("storage", alloc_thread_extra_data_func,
NULL, sock_accept_done_callback, storage_set_body_length,
sock_send_done_callback, storage_deal_task, task_finish_clean_up,

View File

@ -21,6 +21,7 @@
#include "fastcommon/logger.h"
#include "fastcommon/fast_task_queue.h"
#include "fastcommon/fc_atomic.h"
#include "sf/sf_service.h"
#include "fdfs_define.h"
#include "storage_types.h"
@ -47,13 +48,14 @@ static inline void storage_clear_task(struct fast_task_info *pTask)
if (pClientInfo->clean_func != NULL)
{
pClientInfo->clean_func(pTask);
pClientInfo->clean_func = NULL;
}
memset(pTask->arg, 0, sizeof(StorageClientInfo));
}
static inline void storage_release_task(struct fast_task_info *pTask)
{
if (__sync_sub_and_fetch(&pTask->reffer_count, 0) == 1)
if (FC_ATOMIC_GET(pTask->reffer_count) == 1)
{
storage_clear_task(pTask);
}