From 57c993e8d553a3400a5b7fd7d8a1cca96c0ce973 Mon Sep 17 00:00:00 2001 From: Dennis Schwerdel Date: Wed, 17 Jun 2020 22:53:14 +0200 Subject: [PATCH] Fix keepalive for small timeouts --- CHANGELOG.md | 1 + src/cloud.rs | 4 ++-- src/config.rs | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc251f..5fd9225 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project follows [semantic versioning](http://semver.org). - [added] Added crypto option AES128 - [changed] Updated dependencies +- [fixed] Fixed keepalive for small timeouts ### v1.4.0 (2020-06-03) diff --git a/src/cloud.rs b/src/cloud.rs index 0f31c6b..88865e5 100644 --- a/src/cloud.rs +++ b/src/cloud.rs @@ -3,7 +3,7 @@ // This software is licensed under GPL-3 or newer (see LICENSE.md) use std::{ - cmp::min, + cmp::{min, max}, collections::HashMap, fmt, fs::{self, File}, @@ -473,7 +473,7 @@ impl GenericCloud Duration { match self.keepalive { Some(dur) => dur, - None => self.peer_timeout / 2 - 60 + None => max(self.peer_timeout / 2 - 60, 1) } } }