Fix #2768 - remove completed timers

This commit is contained in:
Sergey Lyubka committed 2025-04-11 11:24:10 +01:00
1 parent 40a2a8822f
commit 0539cf1023
7 files changed
+56 -32

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
#include "net.h"
#include "dns.h"
#include "fmt.h"
#include "log.h"
#include "net.h"
#include "printf.h"
#include "profile.h"
#include "timer.h"
@@ -218,8 +218,8 @@ struct mg_timer *mg_timer_add(struct mg_mgr *mgr, uint64_t milliseconds,
unsigned flags, void (*fn)(void *), void *arg) {
struct mg_timer *t = (struct mg_timer *) calloc(1, sizeof(*t));
if (t != NULL) {
flags |= MG_TIMER_AUTODELETE; // We have calloc-ed it, so autodelete
mg_timer_init(&mgr->timers, t, milliseconds, flags, fn, arg);
t->id = mgr->timerid++;
}
return t;
}