fn shutdown(sender: &Sender<Message>, state: &SharedState) -> Message {
    // Remove the unix socket
    {
        let state = state.lock().unwrap();
        if state.settings.shared.use_unix_socket {
            let path = &state.settings.shared.unix_socket_path;
            debug!("Check if a unit socket exists.");
            if std::path::PathBuf::from(&path).exists() {
                std::fs::remove_file(&path).expect("Failed to remove unix socket on shutdown");
            }
            debug!("Removed the unix socket.");
        }
    }

    // Notify the task handler
    sender.send(Message::DaemonShutdown).expect(SENDER_ERR);

    create_success_message("Daemon is shutting down")
}
/// Initialize the shutdown procedure.
/// At first, the unix socket will be removed.
///
/// Next, the DaemonShutdown Message will be forwarded to the TaskHandler.
/// The TaskHandler then gracefully shuts down all child processes
/// and exits with std::proces::exit(0).
Initialize the shutdown procedure.
At first, the unix socket will be removed.

Next, the DaemonShutdown Message will be forwarded to the TaskHandler.
The TaskHandler then gracefully shuts down all child processes
and exits with std::proces::exit(0).
Initialize the shutdown procedure . At first the unix socket will be removed . Next the DaemonShutdown Message will be forwarded to the TaskHandler . The TaskHandler then gracefully shuts down all child processes and exits with std :: proces :: exit ( 0 ) .
fn shutdown(sender: &Sender<Message>, state: &SharedState) -> Message {
    // Remove the unix socket
    {
        let state = state.lock().unwrap();
        if state.settings.shared.use_unix_socket {
            let path = &state.settings.shared.unix_socket_path;
            debug!("Check if a unit socket exists.");
            if std::path::PathBuf::from(&path).exists() {
                std::fs::remove_file(&path).expect("Failed to remove unix socket on shutdown");
            }
            debug!("Removed the unix socket.");
        }
    }
    // Notify the task handler
    sender.send(Message::DaemonShutdown).expect(SENDER_ERR);
    create_success_message("Daemon is shutting down")
}
fn shutdown ( sender : & Sender < Message > , state : & SharedState ) -> Message { // Remove the unix socket { let state = state . lock ( ) . unwrap ( ) ; if state . settings . shared . use_unix_socket { let path = & state . settings . shared . unix_socket_path ; debug ! ( " " ) ; if std :: path :: PathBuf :: from ( & path ) . exists ( ) { std :: fs :: remove_file ( & path ) . expect ( " " ) ; } debug ! ( " " ) ; } } // Notify the task handler sender . send ( Message :: DaemonShutdown ) . expect ( SENDER_ERR ) ; create_success_message ( " " ) }
Initialize the shutdown procedure.
Initialize the shutdown procedure .
sender
&Sender<Message>
state
&SharedState