mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-06 15:51:25 +00:00
Fix #2768 - remove completed timers
This commit is contained in:
1 parent
40a2a8822f
commit
0539cf1023
7 files changed
+56
-32
No files matched your search
@@ -1960,6 +1960,22 @@ static void test_timer(void) {
|
||||
ASSERT(mgr.timers == NULL);
|
||||
ASSERT(mgr.conns == NULL);
|
||||
}
|
||||
|
||||
// Test that non-repeating called timers are deleted, see #2768
|
||||
{
|
||||
struct mg_mgr mgr;
|
||||
int arg = 0;
|
||||
mg_mgr_init(&mgr);
|
||||
mg_timer_add(&mgr, 0, MG_TIMER_ONCE, f1, &arg);
|
||||
ASSERT(mgr.timers != NULL);
|
||||
mg_mgr_poll(&mgr, 10);
|
||||
ASSERT(arg == 1);
|
||||
ASSERT(mgr.timers == NULL);
|
||||
mg_mgr_free(&mgr);
|
||||
ASSERT(mgr.timers == NULL);
|
||||
ASSERT(mgr.conns == NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static bool sn(const char *fmt, ...) {
|
||||
|
||||
Reference in new issue
Block a user