summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbold <bold@cryptoguru.com>2020-01-14 15:49:07 +0100
committerWez Furlong <wez@wezfurlong.org>2020-01-18 08:40:18 -0800
commit297bf959e98b99846fbb85e47baaeeb4ed0b7070 (patch)
tree8c5426d62267204fe5c76e1b7fa16580292e497f
parentc5d2f48aa3eab3d7159b900a66bdc17ed8e29d4e (diff)
downloadssh2-rs-297bf959e98b99846fbb85e47baaeeb4ed0b7070.zip
make set_blocking and is_blocking available for inner session
-rw-r--r--src/session.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/session.rs b/src/session.rs
index 664b78b..efb4b25 100644
--- a/src/session.rs
+++ b/src/session.rs
@@ -197,12 +197,12 @@ impl Session {
/// a blocking session will wait for room. A non-blocking session will
/// return immediately without writing anything.
pub fn set_blocking(&self, blocking: bool) {
- unsafe { raw::libssh2_session_set_blocking(self.inner.raw, blocking as c_int) }
+ self.inner.set_blocking(blocking);
}
/// Returns whether the session was previously set to nonblocking.
pub fn is_blocking(&self) -> bool {
- unsafe { raw::libssh2_session_get_blocking(self.inner.raw) != 0 }
+ self.inner.is_blocking()
}
/// Set timeout for blocking functions.
@@ -955,6 +955,16 @@ impl SessionInner {
Err(Error::from_session_error_raw(self.raw, rc))
}
}
+
+ /// Set or clear blocking mode on session
+ pub fn set_blocking(&self, blocking: bool) {
+ unsafe { raw::libssh2_session_set_blocking(self.raw, blocking as c_int) }
+ }
+
+ /// Returns whether the session was previously set to nonblocking.
+ pub fn is_blocking(&self) -> bool {
+ unsafe { raw::libssh2_session_get_blocking(self.raw) != 0 }
+ }
}
impl Drop for SessionInner {