aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2011-01-10 17:39:47 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2011-01-10 17:39:47 +0100
commitbcea8921ba279712efc79dc46bbe427bc70d8def (patch)
treef82cfa6c506b250d4da81d4638290a39b0133fbb /src
parent076dfb82942384d9839f779a986b95932a754c9e (diff)
downloadlibssh-bcea8921ba279712efc79dc46bbe427bc70d8def.tar.gz
libssh-bcea8921ba279712efc79dc46bbe427bc70d8def.tar.xz
libssh-bcea8921ba279712efc79dc46bbe427bc70d8def.zip
Change blocking parameter to a flag
Diffstat (limited to 'src')
-rw-r--r--src/session.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/session.c b/src/session.c
index cb6382e1..c862e714 100644
--- a/src/session.c
+++ b/src/session.c
@@ -85,7 +85,7 @@ ssh_session ssh_new(void) {
session->alive = 0;
session->auth_methods = 0;
- session->blocking = 1;
+ ssh_set_blocking(session, 1);
session->log_indent = 0;
session->maxchannel = FIRST_CHANNEL;
@@ -280,11 +280,21 @@ void ssh_silent_disconnect(ssh_session session) {
* \bug nonblocking code is in development and won't work as expected
*/
void ssh_set_blocking(ssh_session session, int blocking) {
- if (session == NULL) {
+ if (session == NULL) {
return;
}
+ session->flags &= ~SSH_SESSION_FLAG_BLOCKING;
+ session->flags |= blocking ? SSH_SESSION_FLAG_BLOCKING : 0;
+}
- session->blocking = blocking ? 1 : 0;
+/**
+ * @brief Return the blocking mode of libssh
+ * @param[in] session The SSH session
+ * @returns 0 if the session is nonblocking,
+ * @returns 1 if the functions may block.
+ */
+int ssh_is_blocking(ssh_session session){
+ return (session->flags&SSH_SESSION_FLAG_BLOCKING) ? 1 : 0;
}
/**