mirror of
https://github.com/fafhrd91/actix-net
synced 2025-03-15 13:13:05 +01:00
revert the delete
This commit is contained in:
parent
60e1ebb503
commit
89c9d943fb
@ -217,8 +217,6 @@ impl Accept {
|
||||
self.deregister_all(sockets);
|
||||
}
|
||||
|
||||
self.terminate_all(sockets);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -332,10 +330,6 @@ impl Accept {
|
||||
.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.
|
||||
fn send_connection(&mut self, conn: Conn) -> Result<(), Conn> {
|
||||
let next = self.next();
|
||||
|
@ -41,20 +41,6 @@ impl MioListener {
|
||||
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 {
|
||||
@ -274,17 +260,4 @@ mod tests {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user