1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-03-15 22:03:05 +01:00

revert the delete

This commit is contained in:
Jean Bouchard 2022-02-05 20:53:12 -05:00
parent 60e1ebb503
commit 89c9d943fb
2 changed files with 0 additions and 33 deletions

View File

@ -217,8 +217,6 @@ impl Accept {
self.deregister_all(sockets); self.deregister_all(sockets);
} }
self.terminate_all(sockets);
return true; return true;
} }
@ -332,10 +330,6 @@ impl Accept {
.for_each(|(_, info)| self.deregister_logged(info)); .for_each(|(_, info)| self.deregister_logged(info));
} }
fn terminate_all(&self, sockets: &mut [ServerSocketInfo]) {
sockets.iter().for_each(|s| s.lst.terminate());
}
// Send connection to worker and handle error. // Send connection to worker and handle error.
fn send_connection(&mut self, conn: Conn) -> Result<(), Conn> { fn send_connection(&mut self, conn: Conn) -> Result<(), Conn> {
let next = self.next(); let next = self.next();

View File

@ -41,20 +41,6 @@ impl MioListener {
MioListener::Uds(ref lst) => lst.accept().map(|(stream, _)| MioStream::Uds(stream)), MioListener::Uds(ref lst) => lst.accept().map(|(stream, _)| MioStream::Uds(stream)),
} }
} }
pub(crate) fn terminate(&self) {
match *self {
MioListener::Tcp(_) => (),
#[cfg(unix)]
MioListener::Uds(ref lst) => {
if let Ok(addr) = lst.local_addr() {
if let Some(path) = addr.as_pathname() {
let _ = std::fs::remove_file(path);
}
}
}
}
}
} }
impl Source for MioListener { impl Source for MioListener {
@ -274,17 +260,4 @@ mod tests {
assert!(format!("{}", lst).contains("/tmp/sock.xxxxx")); assert!(format!("{}", lst).contains("/tmp/sock.xxxxx"));
} }
} }
#[test]
#[cfg(unix)]
fn uds_terminate() {
let socket_path = std::path::Path::new("/tmp/sock.xxxx1");
let _ = std::fs::remove_file(socket_path);
if let Ok(socket) = MioUnixListener::bind(socket_path) {
let listener = MioListener::Uds(socket);
assert!(socket_path.exists());
listener.terminate();
assert!(!socket_path.exists());
}
}
} }