mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
channeld: fix halting gossip when a timer is active.
We would sleep until the next timer, even if that's long past when we would send gossip. Normally we use very short timers, so we didn't notice, but we will in the next patch, where we use continuous timers for pings. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
9138ebf807
commit
140b2deec0
@ -3923,15 +3923,21 @@ int main(int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Might not be waiting for anything. */
|
||||
tptr = NULL;
|
||||
|
||||
if (timer_earliest(&peer->timers, &first)) {
|
||||
timeout = timespec_to_timeval(
|
||||
timemono_between(first, now).ts);
|
||||
tptr = &timeout;
|
||||
} else if (time_to_next_gossip(peer->pps, &trel)) {
|
||||
}
|
||||
|
||||
/* If timer to next gossip is sooner, use that instead. */
|
||||
if (time_to_next_gossip(peer->pps, &trel)
|
||||
&& (!tptr || time_less(trel, timeval_to_timerel(*tptr)))) {
|
||||
timeout = timerel_to_timeval(trel);
|
||||
tptr = &timeout;
|
||||
} else
|
||||
tptr = NULL;
|
||||
}
|
||||
|
||||
if (select(nfds, &rfds, NULL, NULL, tptr) < 0) {
|
||||
/* Signals OK, eg. SIGUSR1 */
|
||||
|
Loading…
Reference in New Issue
Block a user