Fix file descriptor leak in the listener too

This commit is contained in:
Ilya Zlobintsev 2021-03-07 09:50:04 +02:00
parent 862a46d754
commit 7313019305
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,3 @@
use nix::unistd;
use crate::config::Config;
use crate::gpu_controller::{FanControlInfo, GpuStats};
use crate::gpu_controller::{GpuInfo, PowerProfile};

View File

@ -440,9 +440,11 @@ impl Daemon {
log::trace!("Responding, buffer length {}", buffer.len());
nix::unistd::write(stream, &buffer).expect("Writing response to socket failed");
//stream
// .shutdown(std::net::Shutdown::Write)
// .expect("Could not shut down");
nix::sys::socket::shutdown(stream, nix::sys::socket::Shutdown::Both)
.expect("Failed to shut down");
nix::unistd::close(stream).expect("Failed to close");
log::trace!("Finished responding");
}
Err(_) => {