Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tbraun96 committed Oct 5, 2024
1 parent 26158b2 commit d16f847
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
5 changes: 2 additions & 3 deletions citadel_sdk/examples/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use citadel_io::tokio;
use citadel_sdk::prefabs::client::{ServerConnectionSettings, ServerConnectionSettingsBuilder};
use citadel_sdk::prefabs::client::ServerConnectionSettingsBuilder;
use citadel_sdk::prelude::*;
use std::sync::atomic::{AtomicBool, Ordering};

Expand Down Expand Up @@ -37,8 +37,7 @@ async fn main() {
remote.shutdown_kernel().await?;
Ok(())
},
)
.unwrap();
);

let _ = NodeBuilder::default()
.with_node_type(NodeType::Peer)
Expand Down
20 changes: 11 additions & 9 deletions citadel_sdk/examples/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ async fn main() {
.ensure_registered()
.add();

let finished = &AtomicBool::new(false);
let peer = citadel_sdk::prefabs::client::peer_connection::PeerConnectionKernel::new(
"dummy name",
let server_connection_settings = ServerConnectionSettingsBuilder::credentialed_registration(
addr,
my_peer_id,
"dunny name",
"password",
)
.build()
.unwrap();

let finished = &AtomicBool::new(false);
let peer = citadel_sdk::prefabs::client::peer_connection::PeerConnectionKernel::new(
server_connection_settings,
agg,
addr,
UdpMode::Enabled,
Default::default(),
None,
|mut connection, remote| async move {
let mut connection = connection.recv().await.unwrap()?;
let chan = connection.udp_channel_rx.take();
Expand All @@ -44,8 +47,7 @@ async fn main() {
}
Ok(())
},
)
.unwrap();
);

let _ = NodeBuilder::default()
.with_node_type(NodeType::Peer)
Expand Down
6 changes: 3 additions & 3 deletions citadel_sdk/src/test_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ pub fn server_info<'a>() -> (NodeFuture<'a, EmptyKernel>, SocketAddr) {

#[allow(dead_code)]
#[cfg(feature = "localhost-testing")]
pub fn server_info_reactive<'a, F: 'a, Fut: 'a>(
pub fn server_info_reactive<'a, F, Fut>(
f: F,
opts: impl FnOnce(&mut NodeBuilder),
) -> (NodeFuture<'a, Box<dyn NetKernel + 'a>>, SocketAddr)
where
F: Fn(ConnectionSuccess, ClientServerRemote) -> Fut + Send + Sync,
Fut: Future<Output = Result<(), NetworkError>> + Send + Sync,
F: Fn(ConnectionSuccess, ClientServerRemote) -> Fut + Send + Sync + 'a,
Fut: Future<Output = Result<(), NetworkError>> + Send + Sync + 'a,
{
crate::test_common::server_test_node(
Box::new(ClientConnectListenerKernel::new(f)) as Box<dyn NetKernel>,
Expand Down

0 comments on commit d16f847

Please sign in to comment.