log NULL continue_callback with SF_NIO_STAGE_CONTINUE

connection_manager
YuQing 2021-02-09 22:25:32 +08:00
parent 1b4e0ad870
commit 11165cbb20
2 changed files with 12 additions and 5 deletions

View File

@ -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)
{
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);

View File

@ -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;