mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
handle cancellable option
This commit is contained in:
parent
cdf35db0d6
commit
559e03f904
1 changed files with 8 additions and 4 deletions
|
|
@ -60,10 +60,14 @@ impl Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Close owned [SocketConnection](https://docs.gtk.org/gio/class.SocketConnection.html)
|
/// Close owned [SocketConnection](https://docs.gtk.org/gio/class.SocketConnection.html)
|
||||||
pub fn close(&self) -> Result<(), Error> {
|
/// * return `Ok(false)` if `Cancellable` not defined
|
||||||
match self.socket_connection.close(self.cancellable.as_ref()) {
|
pub fn close(&self) -> Result<bool, Error> {
|
||||||
Ok(()) => Ok(()),
|
match self.cancellable {
|
||||||
Err(e) => Err(Error::SocketConnection(e)),
|
Some(ref cancellable) => match self.socket_connection.close(Some(cancellable)) {
|
||||||
|
Ok(()) => Ok(true),
|
||||||
|
Err(e) => Err(Error::SocketConnection(e)),
|
||||||
|
},
|
||||||
|
None => Ok(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue