diff options
author | gilles henaux <gill.henaux@gmail.com> | 2023-01-15 00:26:22 +0100 |
---|---|---|
committer | gilles henaux <gill.henaux@gmail.com> | 2023-01-15 00:26:22 +0100 |
commit | 8b316885cbe5465864ce8dfb1752433e3bac63e7 (patch) | |
tree | 85c51192c70099abc4478070989884d712b342b3 /src/client.rs | |
parent | b81ee06a892c9c196dff6635a36be8ec48babd08 (diff) |
[channels] Return the default ChannelId when opening connection/endpoint
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client.rs b/src/client.rs index 7e5680b..8a1eee5 100644 --- a/src/client.rs +++ b/src/client.rs @@ -430,11 +430,13 @@ impl Client { } /// Open a connection to a server with the given [ConnectionConfiguration] and [CertificateVerificationMode]. The connection will raise an event when fully connected, see [ConnectionEvent] + /// + /// Returns the [ConnectionId], and the default [ChannelId] pub fn open_connection( &mut self, config: ConnectionConfiguration, cert_mode: CertificateVerificationMode, - ) -> Result<ConnectionId, QuinnetError> { + ) -> Result<(ConnectionId, ChannelId), QuinnetError> { let (bytes_from_server_send, bytes_from_server_recv) = mpsc::channel::<Bytes>(DEFAULT_MESSAGE_QUEUE_SIZE); @@ -460,7 +462,7 @@ impl Client { from_channels_recv, }; // Create default channels - connection.open_channel(ChannelType::OrderedReliable)?; + let ordered_reliable_id = connection.open_channel(ChannelType::OrderedReliable)?; connection.open_channel(ChannelType::UnorderedReliable)?; connection.open_channel(ChannelType::Unreliable)?; @@ -485,7 +487,7 @@ impl Client { self.default_connection_id = Some(connection_id); } - Ok(connection_id) + Ok((connection_id, ordered_reliable_id)) } /// Set the default connection |