IOEventCallback: change event type from short to int

use_iouring
YuQing 2025-10-05 09:44:24 +08:00
parent d5dbe3d030
commit dac653d694
5 changed files with 15 additions and 13 deletions

View File

@ -1,7 +1,8 @@
Version 1.81 2025-10-03
Version 1.81 2025-10-05
* support Linux io_uring
* free_queue support parameter: need_shrink and set task->shrinked
* IOEventCallback: change event type from short to int
Version 1.80 2025-09-10
* getIpaddrByNameEx: IPv4 has priority over IPv6

View File

@ -42,7 +42,7 @@ typedef void (*TaskCleanUpCallback) (struct fast_task_info *task);
typedef int (*TaskInitCallback)(struct fast_task_info *task, void *arg);
typedef void (*TaskReleaseCallback)(struct fast_task_info *task);
typedef void (*IOEventCallback) (int sock, short event, void *arg);
typedef void (*IOEventCallback) (int sock, const int event, void *arg);
typedef int (*TaskContinueCallback)(struct fast_task_info *task);
struct sf_network_handler;
@ -57,9 +57,7 @@ typedef struct ioevent_entry
{
FastTimerEntry timer; //must first
int fd;
#if IOEVENT_USE_URING
int res;
#endif
int res; //just for io_uring, since v1.0.81
IOEventCallback callback;
} IOEventEntry;
@ -128,12 +126,10 @@ struct fast_task_info
uint16_t port; //peer port
#if IOEVENT_USE_URING
struct {
int8_t is_client;
uint8_t op_type;
} uring; //since v1.0.81
#endif
} uring; //just for io_uring, since v1.0.81
struct {
uint8_t current;

View File

@ -185,6 +185,7 @@ int fast_timer_timeouts_get(FastTimer *timer, const int64_t current_time,
} else {
last->rehash = false;
}
continue;
}
} else { //expired

View File

@ -22,7 +22,7 @@
#include "_os_define.h"
#include "logger.h"
#define IOEVENT_TIMEOUT 0x8000
#define IOEVENT_TIMEOUT (1 << 20)
#if IOEVENT_USE_EPOLL
#include <sys/epoll.h>

View File

@ -65,7 +65,7 @@ static int ioevent_process(IOEventPoller *ioevent)
}
} else {
logWarning("file: "__FILE__", line: %d, "
"unexpected flags: %d, result: %u", __LINE__,
"io_uring unexpected flags: %d, result: %d", __LINE__,
ioevent->cqe->flags, ioevent->cqe->res);
}
}
@ -287,9 +287,13 @@ int ioevent_set(struct fast_task_info *task, struct nio_thread_data *pThread,
return result;
}
} else {
logInfo("file: "__FILE__", line: %d, "
"skip uring_prep_recv, fd: %d, port: %d, in progress op type: %d, timeout: %"PRId64,
__LINE__, sock, task->port, FC_URING_OP_TYPE(task), task->event.timer.expires);
/*
logWarning("file: "__FILE__", line: %d, "
"skip uring_prep_recv, fd: %d, port: %d, "
"in progress op type: %d, timeout: %"PRId64,
__LINE__, sock, task->port, FC_URING_OP_TYPE(task),
task->event.timer.expires);
*/
}
} else {
#endif