mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
This is the daemon state, not the state machine state. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
18 lines
440 B
C
18 lines
440 B
C
#include "lightningd.h"
|
|
#include "timeout.h"
|
|
|
|
void init_timeout_(struct timeout *t, unsigned int interval,
|
|
void (*cb)(void *), void *arg)
|
|
{
|
|
timer_init(&t->timer);
|
|
t->interval = time_from_sec(interval);
|
|
t->cb = cb;
|
|
t->arg = arg;
|
|
}
|
|
|
|
void refresh_timeout(struct lightningd_state *dstate, struct timeout *t)
|
|
{
|
|
timer_del(&dstate->timers, &t->timer);
|
|
timer_add(&dstate->timers, &t->timer,
|
|
timeabs_add(time_now(), t->interval));
|
|
}
|