lokinet
lokinet copied to clipboard
handle suspend properly
currently when the event loop jumps ahead a large amount i.e. when after suspending the daemon needs to restart fully.
I don't think the event loop will jump ahead by a large amount because I think (?) it's driven by the monotonic clock, which doesn't advance during sleep (at least on Linux, and I assume something similar on Win/Mac).
That, however, suggests a heuristic: we can periodically (e.g. once/second) check the system clock and if we see a big jump there, reset state/paths/invalidate connections/whatever we need to do to get us back to "let's make some paths" status.
Appears to be the same anticipated behavior I have with Fedora on a MacBook Pro. Leaving it to it's own to reconnect has taken up to 10 minutes after sleep. It will eventually build paths but I restart the daemon to kick it into action.