Fixed problem with growing stats file

pull/46/head
Dennis Schwerdel 2019-12-29 13:03:48 +01:00
parent eb620781a8
commit 44ad73701b
2 changed files with 3 additions and 1 deletions

View File

@ -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)

View File

@ -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<D: Device, P: Protocol, T: Table, S: Socket, TS: TimeSource> GenericCloud<D
fn write_out_stats(&mut self) -> 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)?;