From 11165cbb201cd6d5e0070cfc904439ca6d2088bd Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Tue, 9 Feb 2021 22:25:32 +0800 Subject: [PATCH] log NULL continue_callback with SF_NIO_STAGE_CONTINUE --- src/sf_nio.c | 15 +++++++++++---- src/sf_types.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/sf_nio.c b/src/sf_nio.c index 99fdf24..de26b1d 100644 --- a/src/sf_nio.c +++ b/src/sf_nio.c @@ -312,6 +312,9 @@ int sf_nio_notify(struct fast_task_info *task, const int stage) if (task->continue_callback != NULL) { return task->continue_callback(task); } else { + logWarning("file: "__FILE__", line: %d, " + "task %p, continue_callback is NULL", + __LINE__, task); return 0; } } else { @@ -398,10 +401,14 @@ void sf_recv_notify_read(int sock, short event, void *arg) } else { stage = __sync_add_and_fetch(&task->nio_stages.notify, 0); if (stage != SF_NIO_STAGE_NONE) { - if (stage == SF_NIO_STAGE_CONTINUE && - task->continue_callback != NULL) - { - task->continue_callback(task); + if (stage == SF_NIO_STAGE_CONTINUE) { + if (task->continue_callback != NULL) { + task->continue_callback(task); + } else { + logWarning("file: "__FILE__", line: %d, " + "task %p, continue_callback is NULL", + __LINE__, task); + } } __sync_bool_compare_and_swap(&task->nio_stages.notify, stage, SF_NIO_STAGE_NONE); diff --git a/src/sf_types.h b/src/sf_types.h index 8999572..9d40c4a 100644 --- a/src/sf_types.h +++ b/src/sf_types.h @@ -65,7 +65,7 @@ typedef struct sf_context { typedef struct { int body_len; //body length short flags; - short status; + volatile short status; unsigned char cmd; //command } SFHeaderInfo;