diff options
author | gilles henaux <gill.henaux@gmail.com> | 2023-01-14 23:56:30 +0100 |
---|---|---|
committer | gilles henaux <gill.henaux@gmail.com> | 2023-01-14 23:56:30 +0100 |
commit | 6b6fea8bb6ae2bc681cb2cde44b41b1bff362cd4 (patch) | |
tree | 3a3b9321df62b64f1ea7e0d78544c80f6251a749 /src | |
parent | ccddd98063a2c5cbfffbba2556010bcfd335a4f4 (diff) |
[client & server] Get/set default channel
Diffstat (limited to 'src')
-rw-r--r-- | src/client.rs | 10 | ||||
-rw-r--r-- | src/server.rs | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs index ab8fc2a..7e5680b 100644 --- a/src/client.rs +++ b/src/client.rs @@ -330,6 +330,16 @@ impl Connection { } } + /// Set the default channel + pub fn set_default_channel(&mut self, channel_id: ChannelId) { + self.default_channel = Some(channel_id); + } + + /// Get the default Channel Id + pub fn get_default_channel(&self) -> Option<ChannelId> { + self.default_channel + } + fn create_channel(&mut self, channel_id: ChannelId) -> Result<ChannelId, QuinnetError> { let (bytes_to_channel_send, bytes_to_channel_recv) = mpsc::channel::<Bytes>(DEFAULT_MESSAGE_QUEUE_SIZE); diff --git a/src/server.rs b/src/server.rs index d73ded5..eda7d18 100644 --- a/src/server.rs +++ b/src/server.rs @@ -481,6 +481,16 @@ impl Endpoint { } } + /// Set the default channel + pub fn set_default_channel(&mut self, channel_id: ChannelId) { + self.default_channel = Some(channel_id); + } + + /// Get the default Channel Id + pub fn get_default_channel(&self) -> Option<ChannelId> { + self.default_channel + } + fn open_default_channels(&mut self) -> Result<ChannelId, QuinnetError> { self.open_channel(ChannelType::OrderedReliable)?; self.open_channel(ChannelType::UnorderedReliable)?; |