aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-02-06 10:50:14 +0100
committerAndreas Schneider <asn@cryptomilk.org>2011-02-06 10:50:14 +0100
commit93a2d794591ba8bc21bde28e0d95b5c7505a322c (patch)
treedb45dddfe9ec1149469dc58a730d88115c1c66a0 /src
parent30e4096c66ff110ab8e714c7809042177897b806 (diff)
downloadlibssh-93a2d794591ba8bc21bde28e0d95b5c7505a322c.tar.gz
libssh-93a2d794591ba8bc21bde28e0d95b5c7505a322c.tar.xz
libssh-93a2d794591ba8bc21bde28e0d95b5c7505a322c.zip
session: Added ssh_is_connected().
Diffstat (limited to 'src')
-rw-r--r--src/session.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c
index 02e48d0c..d279142a 100644
--- a/src/session.c
+++ b/src/session.c
@@ -298,6 +298,21 @@ int ssh_is_blocking(ssh_session session){
}
/**
+ * @brief Check if we are connected.
+ *
+ * @param[in] session The session to check if it is connected.
+ *
+ * @return 1 if we are connected, 0 if not.
+ */
+int ssh_is_connected(ssh_session session) {
+ if (session == NULL) {
+ return 0;
+ }
+
+ return session->alive;
+}
+
+/**
* @brief Get the fd of a connection.
*
* In case you'd need the file descriptor of the connection to the server/client.