diff options
author | Henauxg <19689618+Henauxg@users.noreply.github.com> | 2023-07-11 18:58:50 +0200 |
---|---|---|
committer | Henauxg <19689618+Henauxg@users.noreply.github.com> | 2023-07-11 18:58:50 +0200 |
commit | 03fab2e3a49454f0af813601f63ebe306a5fb1f2 (patch) | |
tree | 862bef14fa9e02d438521817d54c18a550e4d953 | |
parent | 4a7fc74cce28d7cbe7ca27256fdf8a4f0bfc0aa7 (diff) |
[client & server] Update to bevy 0.11
-rw-r--r-- | src/client.rs | 7 | ||||
-rw-r--r-- | src/client/certificate.rs | 5 | ||||
-rw-r--r-- | src/client/connection.rs | 4 | ||||
-rw-r--r-- | src/server.rs | 9 |
4 files changed, 15 insertions, 10 deletions
diff --git a/src/client.rs b/src/client.rs index 9211987..16d0943 100644 --- a/src/client.rs +++ b/src/client.rs @@ -330,10 +330,9 @@ impl Plugin for QuinnetClientPlugin { app.init_resource::<Client>(); } - app.add_system( - update_sync_client - .in_base_set(CoreSet::PreUpdate) - .run_if(resource_exists::<Client>()), + app.add_systems( + PreUpdate, + update_sync_client.run_if(resource_exists::<Client>()), ); } } diff --git a/src/client/certificate.rs b/src/client/certificate.rs index a6d9b8c..930093c 100644 --- a/src/client/certificate.rs +++ b/src/client/certificate.rs @@ -8,7 +8,7 @@ use std::{ sync::{Arc, Mutex}, }; -use bevy::prelude::warn; +use bevy::prelude::{warn, Event}; use futures::executor::block_on; use rustls::ServerName as RustlsServerName; use tokio::sync::{mpsc, oneshot}; @@ -21,6 +21,7 @@ pub const DEFAULT_CERT_VERIFIER_BEHAVIOUR: CertVerifierBehaviour = CertVerifierBehaviour::ImmediateAction(CertVerifierAction::AbortConnection); /// Event raised when a user/app interaction is needed for the server's certificate validation +#[derive(Event)] pub struct CertInteractionEvent { pub connection_id: ConnectionId, /// The current status of the verification @@ -49,12 +50,14 @@ impl CertInteractionEvent { } /// Event raised when a new certificate is trusted +#[derive(Event)] pub struct CertTrustUpdateEvent { pub connection_id: ConnectionId, pub cert_info: CertVerificationInfo, } /// Event raised when a connection is aborted during the certificate verification +#[derive(Event)] pub struct CertConnectionAbortEvent { pub connection_id: ConnectionId, pub status: CertVerificationStatus, diff --git a/src/client/connection.rs b/src/client/connection.rs index 4328d73..d8c49c6 100644 --- a/src/client/connection.rs +++ b/src/client/connection.rs @@ -5,7 +5,7 @@ use std::{ sync::Arc, }; -use bevy::prelude::{error, info}; +use bevy::prelude::{error, info, Event}; use bytes::Bytes; use quinn::{ClientConfig, Endpoint}; use quinn_proto::ConnectionStats; @@ -39,10 +39,12 @@ use super::{ pub type ConnectionId = u64; /// Connection event raised when the client just connected to the server. Raised in the CoreStage::PreUpdate stage. +#[derive(Event)] pub struct ConnectionEvent { pub id: ConnectionId, } /// ConnectionLost event raised when the client is considered disconnected from the server. Raised in the CoreStage::PreUpdate stage. +#[derive(Event)] pub struct ConnectionLostEvent { pub id: ConnectionId, } diff --git a/src/server.rs b/src/server.rs index 81ee951..7ac6b28 100644 --- a/src/server.rs +++ b/src/server.rs @@ -41,12 +41,14 @@ pub mod certificate; pub const DEFAULT_INTERNAL_MESSAGE_CHANNEL_SIZE: usize = 100; /// Connection event raised when a client just connected to the server. Raised in the CoreStage::PreUpdate stage. +#[derive(Event)] pub struct ConnectionEvent { /// Id of the client who connected pub id: ClientId, } /// ConnectionLost event raised when a client is considered disconnected from the server. Raised in the CoreStage::PreUpdate stage. +#[derive(Event)] pub struct ConnectionLostEvent { /// Id of the client who lost connection pub id: ClientId, @@ -976,10 +978,9 @@ impl Plugin for QuinnetServerPlugin { app.init_resource::<Server>(); } - app.add_system( - update_sync_server - .in_base_set(CoreSet::PreUpdate) - .run_if(resource_exists::<Server>()), + app.add_systems( + PreUpdate, + update_sync_server.run_if(resource_exists::<Server>()), ); } } |