From 44ad73701b996ee3528d8a6f618d9827db3e9dd9 Mon Sep 17 00:00:00 2001 From: Dennis Schwerdel Date: Sun, 29 Dec 2019 13:03:48 +0100 Subject: [PATCH] Fixed problem with growing stats file --- CHANGELOG.md | 1 + src/cloud.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a94e6be..3d16bc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project follows [semantic versioning](http://semver.org). - [added] Added feature to disable special NAT support - [changed] Improved port forwarding on quirky routers - [changed] Reduced peer timeout to 5min to work better with NAT +- [fixed] Fixed problem with growing stats file ### v1.2.1 (2019-12-22) diff --git a/src/cloud.rs b/src/cloud.rs index 3f1f5f6..f5733e2 100644 --- a/src/cloud.rs +++ b/src/cloud.rs @@ -8,7 +8,7 @@ use std::{ fmt, fs::{self, File}, hash::BuildHasherDefault, - io::{self, Write}, + io::{self, Seek, SeekFrom, Write}, marker::PhantomData, net::{SocketAddr, ToSocketAddrs}, path::Path @@ -585,6 +585,7 @@ impl GenericCloud Result<(), io::Error> { if let Some(ref mut f) = self.stats_file { debug!("Writing out stats"); + f.seek(SeekFrom::Start(0))?; f.set_len(0)?; self.peers.write_out(f)?; writeln!(f)?;