diff options
author | Zachary Heilbron <zheilbron@gmail.com> | 2023-01-07 11:46:28 -1000 |
---|---|---|
committer | Zachary Heilbron <zheilbron@gmail.com> | 2023-01-07 11:53:17 -1000 |
commit | 99e7926ee092db7ae8601b1fc5fbaebf1574d30f (patch) | |
tree | e668fe4b055311b79c4c79a762727f89c6114994 /src/client.rs | |
parent | cc3a4e934bf9ecf52d7e675ded9781bec5d43289 (diff) |
[client] expose connection ids in connection events
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client.rs b/src/client.rs index 3ad2174..3369c1e 100644 --- a/src/client.rs +++ b/src/client.rs @@ -47,9 +47,13 @@ pub const DEFAULT_KNOWN_HOSTS_FILE: &str = "quinnet/known_hosts"; pub type ConnectionId = u64; /// Connection event raised when the client just connected to the server. Raised in the CoreStage::PreUpdate stage. -pub struct ConnectionEvent(ConnectionId); +pub struct ConnectionEvent { + pub id: ConnectionId, +} /// ConnectionLost event raised when the client is considered disconnected from the server. Raised in the CoreStage::PreUpdate stage. -pub struct ConnectionLostEvent(ConnectionId); +pub struct ConnectionLostEvent { + pub id: ConnectionId, +} /// Configuration of the client, used when connecting to a server #[derive(Debug, Deserialize, Clone)] @@ -539,11 +543,11 @@ fn update_sync_client( match message { InternalAsyncMessage::Connected(internal_connection) => { connection.state = ConnectionState::Connected(internal_connection); - connection_events.send(ConnectionEvent(*connection_id)); + connection_events.send(ConnectionEvent { id: *connection_id }); } InternalAsyncMessage::LostConnection => { connection.state = ConnectionState::Disconnected; - connection_lost_events.send(ConnectionLostEvent(*connection_id)); + connection_lost_events.send(ConnectionLostEvent { id: *connection_id }); } InternalAsyncMessage::CertificateInteractionRequest { status, |