mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-07 16:01:30 +00:00
Merge pull request #3100 from cesanta/timers
Fix #2768 - remove completed timers
This commit is contained in:
7 files changed
+56
-32
No files matched your search
+11
-11
@@ -1043,16 +1043,17 @@ void mg_log_set_fn(mg_pfn_t fn, void *param);
|
||||
|
||||
|
||||
struct mg_timer {
|
||||
unsigned long id; // Timer ID
|
||||
uint64_t period_ms; // Timer period in milliseconds
|
||||
uint64_t expire; // Expiration timestamp in milliseconds
|
||||
unsigned flags; // Possible flags values below
|
||||
#define MG_TIMER_ONCE 0 // Call function once
|
||||
#define MG_TIMER_REPEAT 1 // Call function periodically
|
||||
#define MG_TIMER_RUN_NOW 2 // Call immediately when timer is set
|
||||
void (*fn)(void *); // Function to call
|
||||
void *arg; // Function argument
|
||||
struct mg_timer *next; // Linkage
|
||||
uint64_t period_ms; // Timer period in milliseconds
|
||||
uint64_t expire; // Expiration timestamp in milliseconds
|
||||
unsigned flags; // Possible flags values below
|
||||
#define MG_TIMER_ONCE 0 // Call function once
|
||||
#define MG_TIMER_REPEAT 1 // Call function periodically
|
||||
#define MG_TIMER_RUN_NOW 2 // Call immediately when timer is set
|
||||
#define MG_TIMER_CALLED 4 // Timer function was called at least once
|
||||
#define MG_TIMER_AUTODELETE 8 // free() timer when done
|
||||
void (*fn)(void *); // Function to call
|
||||
void *arg; // Function argument
|
||||
struct mg_timer *next; // Linkage
|
||||
};
|
||||
|
||||
void mg_timer_init(struct mg_timer **head, struct mg_timer *timer,
|
||||
@@ -2232,7 +2233,6 @@ struct mg_mgr {
|
||||
int dnstimeout; // DNS resolve timeout in milliseconds
|
||||
bool use_dns6; // Use DNS6 server by default, see #1532
|
||||
unsigned long nextid; // Next connection ID
|
||||
unsigned long timerid; // Next timer ID
|
||||
void *userdata; // Arbitrary user data pointer
|
||||
void *tls_ctx; // TLS context shared by all TLS sessions
|
||||
uint16_t mqtt_id; // MQTT IDs for pub/sub
|
||||
|
||||
Reference in new issue
Block a user