diff --git a/src/sf_global.c b/src/sf_global.c index 29f2180..2cef752 100644 --- a/src/sf_global.c +++ b/src/sf_global.c @@ -104,7 +104,7 @@ static int load_network_parameters(IniFullContext *ini_ctx, g_sf_global_vars.max_buff_size = g_sf_global_vars.max_pkg_size; } else { g_sf_global_vars.min_buff_size = iniGetByteCorrectValueEx(ini_ctx, - "min_buff_size", SF_DEF_MIN_BUFF_SIZE, 1, 8192, + "min_buff_size", SF_DEF_MIN_BUFF_SIZE, 1, 4096, SF_MAX_NETWORK_BUFF_SIZE, true); g_sf_global_vars.max_buff_size = iniGetByteCorrectValueEx(ini_ctx, "max_buff_size", SF_DEF_MAX_BUFF_SIZE, 1, 8192, diff --git a/src/sf_service.h b/src/sf_service.h index b5470cb..892edc3 100644 --- a/src/sf_service.h +++ b/src/sf_service.h @@ -50,17 +50,17 @@ int sf_service_init_ex2(SFContext *sf_context, const char *name, thread_loop_callback, accept_done_callback, set_body_length_func, \ deal_func, task_cleanup_func, timeout_callback, net_timeout_ms, \ proto_header_size, task_arg_size) \ - sf_service_init_ex2(sf_context, name, alloc_thread_extra_data_callback, \ - thread_loop_callback, accept_done_callback, set_body_length_func, \ - deal_func, task_cleanup_func, timeout_callback, net_timeout_ms, \ + sf_service_init_ex2(sf_context, name, alloc_thread_extra_data_callback, \ + thread_loop_callback, accept_done_callback, set_body_length_func, \ + NULL, deal_func, task_cleanup_func, timeout_callback, net_timeout_ms, \ proto_header_size, task_arg_size, NULL, NULL) #define sf_service_init(name, alloc_thread_extra_data_callback, \ thread_loop_callback, accept_done_callback, set_body_length_func, \ deal_func, task_cleanup_func, timeout_callback, net_timeout_ms, \ proto_header_size, task_arg_size) \ - sf_service_init_ex2(&g_sf_context, name, alloc_thread_extra_data_callback, \ - thread_loop_callback, accept_done_callback, set_body_length_func, \ + sf_service_init_ex2(&g_sf_context, name, alloc_thread_extra_data_callback, \ + thread_loop_callback, accept_done_callback, set_body_length_func, NULL, \ deal_func, task_cleanup_func, timeout_callback, net_timeout_ms, \ proto_header_size, task_arg_size, NULL, NULL) diff --git a/src/sf_shared_mbuffer.h b/src/sf_shared_mbuffer.h index 809d549..6632c9a 100644 --- a/src/sf_shared_mbuffer.h +++ b/src/sf_shared_mbuffer.h @@ -70,13 +70,16 @@ static inline SFSharedMBuffer *sf_shared_mbuffer_alloc_ex( fc_sleep_ms(sleep_ms); } - logInfo("file: "__FILE__", line: %d, " - "alloc shared buffer: %p, buff: %p", - __LINE__, buffer, buffer->buff); - if (init_reffer_count > 0) { __sync_add_and_fetch(&buffer->reffer_count, init_reffer_count); } + + /* + logInfo("file: "__FILE__", line: %d, " + "alloc shared buffer: %p, buff: %p, reffer_count: %d", + __LINE__, buffer, buffer->buff, __sync_add_and_fetch(&buffer->reffer_count, 0)); + */ + return buffer; } @@ -88,8 +91,10 @@ static inline void sf_shared_mbuffer_hold(SFSharedMBuffer *buffer) static inline void sf_shared_mbuffer_release(SFSharedMBuffer *buffer) { if (__sync_sub_and_fetch(&buffer->reffer_count, 1) == 0) { + /* logInfo("file: "__FILE__", line: %d, " "free shared buffer: %p", __LINE__, buffer); + */ fast_allocator_free(&buffer->ctx->allocator, buffer); } }