Change return value of aeTimeProc callback function to long long. (#1057)
moduleTimerHandler is aeTimeProc handler and event loop gets created with this. However, found that the function return type is int but actually returns "long long" value(i.e., next_period). and return value being assigned to int variable in processTimeEvents(where time events are processed), this might cause an overflow of the timer values. So changed the return type of the function to long long. And also updated other callback function return type to be consistent. I found this when I was checking functions reported in https://github.com/valkey-io/valkey/issues/1054 issue stacktrace. (FYI, this is just to update the return type to be consistent and it will not the fix for the issue reported) Signed-off-by: Shivshankar-Reddy <shiva.sheri.github@gmail.com>
This commit is contained in:
parent
bf8183d065
commit
a37dee4b3a
2
src/ae.c
2
src/ae.c
@ -363,7 +363,7 @@ static int processTimeEvents(aeEventLoop *eventLoop) {
|
||||
}
|
||||
|
||||
if (te->when <= now) {
|
||||
int retval;
|
||||
long long retval;
|
||||
|
||||
id = te->id;
|
||||
te->refcount++;
|
||||
|
2
src/ae.h
2
src/ae.h
@ -67,7 +67,7 @@ struct aeEventLoop;
|
||||
|
||||
/* Types and data structures */
|
||||
typedef void aeFileProc(struct aeEventLoop *eventLoop, int fd, void *clientData, int mask);
|
||||
typedef int aeTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData);
|
||||
typedef long long aeTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData);
|
||||
typedef void aeEventFinalizerProc(struct aeEventLoop *eventLoop, void *clientData);
|
||||
typedef void aeBeforeSleepProc(struct aeEventLoop *eventLoop);
|
||||
typedef void aeAfterSleepProc(struct aeEventLoop *eventLoop, int numevents);
|
||||
|
@ -447,7 +447,7 @@ int overMaxmemoryAfterAlloc(size_t moremem) {
|
||||
* eviction cycles until the "maxmemory" condition has resolved or there are no
|
||||
* more evictable items. */
|
||||
static int isEvictionProcRunning = 0;
|
||||
static int evictionTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
static long long evictionTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
UNUSED(eventLoop);
|
||||
UNUSED(id);
|
||||
UNUSED(clientData);
|
||||
|
@ -9113,7 +9113,7 @@ typedef struct ValkeyModuleTimer {
|
||||
|
||||
/* This is the timer handler that is called by the main event loop. We schedule
|
||||
* this timer to be called when the nearest of our module timers will expire. */
|
||||
int moduleTimerHandler(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
long long moduleTimerHandler(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
UNUSED(eventLoop);
|
||||
UNUSED(id);
|
||||
UNUSED(clientData);
|
||||
|
@ -672,7 +672,7 @@ static void connRdmaEventHandler(struct aeEventLoop *el, int fd, void *clientDat
|
||||
}
|
||||
}
|
||||
|
||||
static int rdmaKeepaliveTimeProc(struct aeEventLoop *el, long long id, void *clientData) {
|
||||
static long long rdmaKeepaliveTimeProc(struct aeEventLoop *el, long long id, void *clientData) {
|
||||
struct rdma_cm_id *cm_id = clientData;
|
||||
RdmaContext *ctx = cm_id->context;
|
||||
connection *conn = ctx->conn;
|
||||
|
@ -1257,7 +1257,7 @@ void cronUpdateMemoryStats(void) {
|
||||
* a macro is used: run_with_period(milliseconds) { .... }
|
||||
*/
|
||||
|
||||
int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
int j;
|
||||
UNUSED(eventLoop);
|
||||
UNUSED(id);
|
||||
|
@ -195,7 +195,7 @@ static redisContext *getRedisContext(const char *ip, int port, const char *hosts
|
||||
static void freeServerConfig(serverConfig *cfg);
|
||||
static int fetchClusterSlotsConfiguration(client c);
|
||||
static void updateClusterSlotsConfiguration(void);
|
||||
int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData);
|
||||
static long long showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData);
|
||||
|
||||
/* Dict callbacks */
|
||||
static uint64_t dictSdsHash(const void *key);
|
||||
@ -1604,7 +1604,7 @@ usage:
|
||||
exit(exit_status);
|
||||
}
|
||||
|
||||
int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
long long showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
UNUSED(eventLoop);
|
||||
UNUSED(id);
|
||||
benchmarkThread *thread = (benchmarkThread *)clientData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user