chore: clean up desktop
This commit is contained in:
1 parent
67a6fa9eb8
commit
1b14b309e9
19 files changed
+305
-298
No files matched your search
@@ -1,28 +1,31 @@
|
||||
use dioxus_core::VirtualDom;
|
||||
use interprocess::local_socket::LocalSocketStream;
|
||||
// use interprocess::local_socket::{LocalSocketListener, LocalSocketStream};
|
||||
|
||||
use interprocess::local_socket::{LocalSocketListener, LocalSocketStream};
|
||||
use std::io::{BufRead, BufReader};
|
||||
use std::time::Duration;
|
||||
use std::{sync::Arc, sync::Mutex};
|
||||
|
||||
fn _handle_error(connection: std::io::Result<LocalSocketStream>) -> Option<LocalSocketStream> {
|
||||
fn handle_error(connection: std::io::Result<LocalSocketStream>) -> Option<LocalSocketStream> {
|
||||
connection
|
||||
.map_err(|error| eprintln!("Incoming connection failed: {}", error))
|
||||
.ok()
|
||||
}
|
||||
|
||||
pub(crate) fn _init(_dom: &VirtualDom) {
|
||||
pub(crate) fn init(_dom: &VirtualDom) {
|
||||
let latest_in_connection: Arc<Mutex<Option<BufReader<LocalSocketStream>>>> =
|
||||
Arc::new(Mutex::new(None));
|
||||
let _latest_in_connection_handle = latest_in_connection.clone();
|
||||
|
||||
let latest_in_connection_handle = latest_in_connection.clone();
|
||||
|
||||
// connect to processes for incoming data
|
||||
std::thread::spawn(move || {
|
||||
// if let Ok(listener) = LocalSocketListener::bind("@dioxusin") {
|
||||
// for conn in listener.incoming().filter_map(handle_error) {
|
||||
// *latest_in_connection_handle.lock().unwrap() = Some(BufReader::new(conn));
|
||||
// }
|
||||
// }
|
||||
let temp_file = std::env::temp_dir().join("@dioxusin");
|
||||
|
||||
if let Ok(listener) = LocalSocketListener::bind(temp_file) {
|
||||
for conn in listener.incoming().filter_map(handle_error) {
|
||||
*latest_in_connection_handle.lock().unwrap() = Some(BufReader::new(conn));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
std::thread::spawn(move || {
|
||||
|
||||
Reference in new issue
Block a user