Log details about ping schedule

This commit is contained in:
Davide De Rosa 2019-12-12 13:29:20 +01:00
parent 5b0df2eada
commit 8ae92d29db
1 changed files with 3 additions and 0 deletions

View File

@ -574,10 +574,13 @@ public class OpenVPNSession: Session {
private func scheduleNextPing(elapsed: TimeInterval = 0.0) {
guard let interval = keepAliveInterval else {
log.verbose("Skip ping, keep-alive not set")
return
}
let remaining = min(interval, interval - elapsed)
log.verbose("Schedule ping after \(remaining) seconds (interval=\(interval), elapsed=\(elapsed))")
queue.asyncAfter(deadline: .now() + remaining) { [weak self] in
log.verbose("Running ping block")
self?.ping()
}
}