handle SocketConnection close errors, remove deprecated implementation

This commit is contained in:
yggverse 2024-11-30 16:55:43 +02:00
parent 79f219ba76
commit 6ee60e9d9d

View file

@ -51,24 +51,12 @@ impl Connection {
// Actions
/// Close owned [SocketConnection](https://docs.gtk.org/gio/class.SocketConnection.html)
/// and [TlsClientConnection](https://docs.gtk.org/gio/iface.TlsClientConnection.html) if active
pub fn close(&self) -> Result<(), Error> {
/* Do not close `TlsClientConnection` as wanted for re-handshake
on user certificate change in runtime! @TODO
if let Some(ref tls_client_connection) = self.tls_client_connection {
if !tls_client_connection.is_closed() {
if let Err(e) = tls_client_connection.close(self.cancellable.as_ref()) {
return Err(Error::TlsClientConnection(e));
match self.socket_connection.close(self.cancellable.as_ref()) {
Ok(()) => Ok(()),
Err(e) => Err(Error::SocketConnection(e)),
}
}
} */
if !self.socket_connection.is_closed() {
if let Err(e) = self.socket_connection.close(self.cancellable.as_ref()) {
return Err(Error::SocketConnection(e));
}
}
Ok(())
}
/// Request force handshake for `Self`
/// * useful for certificate change in runtime