From f3c9c4bb7e3a32e69df9b878145fbdd08a3655d4 Mon Sep 17 00:00:00 2001 From: Henauxg <19689618+Henauxg@users.noreply.github.com> Date: Fri, 18 Nov 2022 15:49:46 +0100 Subject: [server] Rework : add Endpoint --- src/lib.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index e25c68a..813a344 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,3 @@ -// pub const DEFAULT_MESSAGE_QUEUE_SIZE: usize = 150; -// pub const DEFAULT_KILL_MESSAGE_QUEUE_SIZE: usize = 10; -// pub const DEFAULT_KEEP_ALIVE_INTERVAL_S: u64 = 4; - pub mod client; pub mod server; pub mod shared; @@ -127,6 +123,7 @@ mod tests { let (client_message, client_id) = server_app .world .resource_mut::() + .endpoint_mut() .receive_message::() .expect("Failed to receive client message") .expect("There should be a client message"); @@ -144,6 +141,7 @@ mod tests { { let server = server_app.world.resource::(); server + .endpoint() .broadcast_message(sent_server_message.clone()) .unwrap(); } @@ -200,7 +198,7 @@ mod tests { { let mut server = server_app.world.resource_mut::(); server - .start( + .open_endpoint( ServerConfigurationData::new( SERVER_HOST.to_string(), SERVER_PORT, @@ -308,12 +306,11 @@ mod tests { } // Server reboots, and generates a new self-signed certificate - // TODO Close server endpoint here - { let mut server = server_app.world.resource_mut::(); + server.close_endpoint(); server - .start( + .open_endpoint( ServerConfigurationData::new( SERVER_HOST.to_string(), SERVER_PORT, @@ -451,7 +448,7 @@ mod tests { fn start_listening(mut server: ResMut) { server - .start( + .open_endpoint( ServerConfigurationData::new( SERVER_HOST.to_string(), SERVER_PORT, -- cgit v1.2.3