aboutsummaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-18 11:45:29 +0100
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-18 11:45:29 +0100
commitf3be35ee7b63f8a33c627902766d235dd02d8ed0 (patch)
treee31bbdc1fe304a0f1e8bb3361366f62d169211e5 /src/client.rs
parentc141eecc97fc4aae0a5ad9d6570c01575c58d9de (diff)
[client] Hide disconnect function from Connection public API
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/client.rs b/src/client.rs
index fe2e4da..39c12db 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -139,17 +139,6 @@ pub struct Connection {
}
impl Connection {
- /// Disconnect from the server on this connection. This does not send any message to the server, and simply closes all the connection's tasks locally.
- pub fn disconnect(&mut self) -> Result<(), QuinnetError> {
- if self.is_connected() {
- if let Err(_) = self.close_sender.send(()) {
- return Err(QuinnetError::ChannelClosed);
- }
- }
- self.state = ConnectionState::Disconnected;
- Ok(())
- }
-
pub fn receive_message<T: serde::de::DeserializeOwned>(
&mut self,
) -> Result<Option<T>, QuinnetError> {
@@ -192,6 +181,17 @@ impl Connection {
pub fn is_connected(&self) -> bool {
return self.state == ConnectionState::Connected;
}
+
+ /// Disconnect from the server on this connection. This does not send any message to the server, and simply closes all the connection's tasks locally.
+ fn disconnect(&mut self) -> Result<(), QuinnetError> {
+ if self.is_connected() {
+ if let Err(_) = self.close_sender.send(()) {
+ return Err(QuinnetError::ChannelClosed);
+ }
+ }
+ self.state = ConnectionState::Disconnected;
+ Ok(())
+ }
}
#[derive(Resource)]