to be consistent with other caller sites of add_event_after(). the
original intention of doing so, is to avoid double free of the callback
to be added if we are stopping and the timer refuses to add this
callback.
Signed-off-by: Kefu Chai <kchai@redhat.com>
send_report();
send_pgstats();
if (stats_period != 0) {
- report_callback = new FunctionContext([this](int){send_stats();});
- timer.add_event_after(stats_period, report_callback);
+ report_callback = timer.add_event_after(
+ stats_period,
+ new FunctionContext([this](int) {
+ send_stats();
+ }));
}
}