refactor: Making timers independent of the lightningd_state

The `dstate` reference was only an indirection to the `timers`
sub-structure anyway, so removing this indirection allows us to reuse
the timers in the subdaemon arch.
This commit is contained in:
Christian Decker
2017-02-04 15:32:02 +01:00
parent 597687d1f0
commit 1c4c874d3f
6 changed files with 22 additions and 21 deletions

View File

@@ -8,15 +8,15 @@
#include <ccan/typesafe_cb/typesafe_cb.h>
/* tal_free this to disable timer. */
struct oneshot *new_reltimer_(struct lightningd_state *dstate,
struct oneshot *new_reltimer_(struct timers *timers,
const tal_t *ctx,
struct timerel expire,
void (*cb)(void *), void *arg);
#define new_reltimer(dstate, ctx, relexpire, func, arg) \
new_reltimer_((dstate), (ctx), (relexpire), \
#define new_reltimer(timers, ctx, relexpire, func, arg) \
new_reltimer_((timers), (ctx), (relexpire), \
typesafe_cb(void, void *, (func), (arg)), (arg))
void timer_expired(struct lightningd_state *dstate, struct timer *timer);
void timer_expired(tal_t *ctx, struct timer *timer);
#endif /* LIGHTNING_DAEMON_TIMEOUT_H */