add macro sf_nio_notify_silence
parent
0c4b35719c
commit
62a35f03d5
|
|
@ -318,7 +318,7 @@ int idempotency_client_channel_push(struct idempotency_client_channel *channel,
|
|||
if (notify) {
|
||||
if (__sync_add_and_fetch(&channel->in_ioevent, 0)) {
|
||||
if (__sync_add_and_fetch(&channel->established, 0)) {
|
||||
sf_nio_notify(channel->task, SF_NIO_STAGE_CONTINUE);
|
||||
sf_nio_notify_silence(channel->task, SF_NIO_STAGE_CONTINUE);
|
||||
}
|
||||
} else {
|
||||
return idempotency_client_channel_check_reconnect(channel);
|
||||
|
|
|
|||
28
src/sf_nio.c
28
src/sf_nio.c
|
|
@ -285,7 +285,7 @@ static int sf_nio_deal_task(struct fast_task_info *task)
|
|||
}
|
||||
|
||||
int sf_nio_notify_ex(struct fast_task_info *task, const int new_stage,
|
||||
const char *file, const int line)
|
||||
const int log_level, const char *file, const int line)
|
||||
{
|
||||
int64_t n;
|
||||
int result;
|
||||
|
|
@ -298,11 +298,14 @@ int sf_nio_notify_ex(struct fast_task_info *task, const int new_stage,
|
|||
new_stage == SF_NIO_STAGE_CLOSE))
|
||||
{
|
||||
if (SF_NIO_STAGE_IS_INPROGRESS(old_stage)) {
|
||||
logWarning("file: "__FILE__", line: %d, "
|
||||
"from caller {file: %s, line: %d}, "
|
||||
"client ip: %s, nio stage in progress, "
|
||||
"current stage: %d, skip set to %d", __LINE__,
|
||||
file, line, task->client_ip, old_stage, new_stage);
|
||||
if (FC_LOG_BY_LEVEL(log_level)) {
|
||||
log_it_ex(&g_log_context, log_level,
|
||||
"file: "__FILE__", line: %d, "
|
||||
"from caller {file: %s, line: %d}, "
|
||||
"client ip: %s, nio stage in progress, "
|
||||
"current stage: %d, skip set to %d", __LINE__,
|
||||
file, line, task->client_ip, old_stage, new_stage);
|
||||
}
|
||||
return EBUSY;
|
||||
}
|
||||
}
|
||||
|
|
@ -310,11 +313,14 @@ int sf_nio_notify_ex(struct fast_task_info *task, const int new_stage,
|
|||
if (!__sync_bool_compare_and_swap(&task->nio_stage,
|
||||
old_stage, new_stage))
|
||||
{
|
||||
logWarning("file: "__FILE__", line: %d, "
|
||||
"from caller {file: %s, line: %d}, "
|
||||
"client ip: %s, skip set stage to %d because stage "
|
||||
"changed, current stage: %d", __LINE__, file, line,
|
||||
task->client_ip, new_stage, SF_NIO_TASK_STAGE_FETCH(task));
|
||||
if (FC_LOG_BY_LEVEL(log_level)) {
|
||||
log_it_ex(&g_log_context, log_level,
|
||||
"file: "__FILE__", line: %d, "
|
||||
"from caller {file: %s, line: %d}, "
|
||||
"client ip: %s, skip set stage to %d because stage "
|
||||
"changed, current stage: %d", __LINE__, file, line,
|
||||
task->client_ip, new_stage, SF_NIO_TASK_STAGE_FETCH(task));
|
||||
}
|
||||
return EEXIST;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,10 +51,13 @@ int sf_client_sock_read(int sock, short event, void *arg);
|
|||
void sf_task_finish_clean_up(struct fast_task_info *task);
|
||||
|
||||
int sf_nio_notify_ex(struct fast_task_info *task, const int new_stage,
|
||||
const char *file, const int line);
|
||||
const int log_level, const char *file, const int line);
|
||||
|
||||
#define sf_nio_notify(task, new_stage) \
|
||||
sf_nio_notify_ex(task, new_stage, __FILE__, __LINE__)
|
||||
sf_nio_notify_ex(task, new_stage, LOG_WARNING, __FILE__, __LINE__)
|
||||
|
||||
#define sf_nio_notify_silence(task, new_stage) \
|
||||
sf_nio_notify_ex(task, new_stage, LOG_NOTHING, __FILE__, __LINE__)
|
||||
|
||||
#define sf_nio_task_is_idle(task) \
|
||||
(task->offset == 0 && task->length == 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue