reorder actions, add comments

This commit is contained in:
yggverse 2024-11-30 04:17:27 +02:00
parent a06e4e9eff
commit 873489df29

View file

@ -65,6 +65,16 @@ impl Connection {
Ok(()) Ok(())
} }
/// Request force handshake for `Self` connection
/// * useful for certificate change in runtime
pub fn rehandshake(&self) -> Result<(), Error> {
match self.tls_client_connection()?.handshake(Cancellable::NONE) {
// @TODO shared `Cancellable`
Ok(()) => Ok(()),
Err(e) => Err(Error::Rehandshake(e)),
}
}
// Getters // Getters
/// Upcast [IOStream](https://docs.gtk.org/gio/class.IOStream.html) /// Upcast [IOStream](https://docs.gtk.org/gio/class.IOStream.html)
@ -78,6 +88,8 @@ impl Connection {
} }
} }
/// Get [TlsClientConnection](https://docs.gtk.org/gio/iface.TlsClientConnection.html) for `Self`
/// * compatible with user and guest sessions
pub fn tls_client_connection(&self) -> Result<TlsClientConnection, Error> { pub fn tls_client_connection(&self) -> Result<TlsClientConnection, Error> {
match self.tls_client_connection.clone() { match self.tls_client_connection.clone() {
// User session // User session
@ -95,13 +107,6 @@ impl Connection {
} }
} }
} }
pub fn rehandshake(&self) -> Result<(), Error> {
match self.tls_client_connection()?.handshake(Cancellable::NONE) {
Ok(()) => Ok(()),
Err(e) => Err(Error::Rehandshake(e)),
}
}
} }
// Tools // Tools