|
|
@ -38,17 +38,15 @@ pub fn start_tcp_server(
|
|
|
|
let address = SocketAddr::new(ip, port);
|
|
|
|
let address = SocketAddr::new(ip, port);
|
|
|
|
let address_string = address.to_string();
|
|
|
|
let address_string = address.to_string();
|
|
|
|
|
|
|
|
|
|
|
|
let join_handle = tokio::task::Builder::new()
|
|
|
|
let join_handle = tokio::task::spawn(async move {
|
|
|
|
.name("mediarepo_tcp::listen")
|
|
|
|
get_builder::<EncryptedListener<TcpListener>>(address)
|
|
|
|
.spawn(async move {
|
|
|
|
.insert::<SubsystemKey>(subsystem)
|
|
|
|
get_builder::<EncryptedListener<TcpListener>>(address)
|
|
|
|
.insert_all(shared_data)
|
|
|
|
.insert::<SubsystemKey>(subsystem)
|
|
|
|
.insert::<SizeMetadataKey>(Default::default())
|
|
|
|
.insert_all(shared_data)
|
|
|
|
.build_server()
|
|
|
|
.insert::<SizeMetadataKey>(Default::default())
|
|
|
|
.await
|
|
|
|
.build_server()
|
|
|
|
.expect("Failed to start tcp server")
|
|
|
|
.await
|
|
|
|
});
|
|
|
|
.expect("Failed to start tcp server")
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok((address_string, join_handle))
|
|
|
|
Ok((address_string, join_handle))
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -66,17 +64,15 @@ pub fn create_unix_socket(
|
|
|
|
if path.exists() {
|
|
|
|
if path.exists() {
|
|
|
|
fs::remove_file(&path)?;
|
|
|
|
fs::remove_file(&path)?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let join_handle = tokio::task::Builder::new()
|
|
|
|
let join_handle = tokio::task::spawn(async move {
|
|
|
|
.name("mediarepo_unix_socket::listen")
|
|
|
|
get_builder::<UnixListener>(path)
|
|
|
|
.spawn(async move {
|
|
|
|
.insert::<SubsystemKey>(subsystem)
|
|
|
|
get_builder::<UnixListener>(path)
|
|
|
|
.insert_all(shared_data)
|
|
|
|
.insert::<SubsystemKey>(subsystem)
|
|
|
|
.insert::<SizeMetadataKey>(Default::default())
|
|
|
|
.insert_all(shared_data)
|
|
|
|
.build_server()
|
|
|
|
.insert::<SizeMetadataKey>(Default::default())
|
|
|
|
.await
|
|
|
|
.build_server()
|
|
|
|
.expect("Failed to create unix domain socket");
|
|
|
|
.await
|
|
|
|
});
|
|
|
|
.expect("Failed to create unix domain socket");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(join_handle)
|
|
|
|
Ok(join_handle)
|
|
|
|
}
|
|
|
|
}
|
|
|
|