summaryrefslogtreecommitdiffstats
path: root/src/session.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2013-02-11 21:37:05 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-07-13 14:03:42 +0200
commit66b37c856c29b77ab548063de2fb64a8435e8b9f (patch)
tree56ef36772657682ab74df2d188584f1da74ca6ae /src/session.c
parent6bc64c368d49d2c775fa4a0e94dc65fcee746710 (diff)
downloadlibssh-66b37c856c29b77ab548063de2fb64a8435e8b9f.tar.gz
libssh-66b37c856c29b77ab548063de2fb64a8435e8b9f.tar.xz
libssh-66b37c856c29b77ab548063de2fb64a8435e8b9f.zip
session: Introduce SSH_TIMEOUT_DEFAULT
The default timeout of 30seconds is very nice when connecting to a new SSH session, however it completely breaks the synchronous blocking API. Use SSH_TIMEOUT_DEFAULT when in blocking mode so channel reads&write are blocking as expected Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c
index 4e71394..1faf0d6 100644
--- a/src/session.c
+++ b/src/session.c
@@ -512,6 +512,7 @@ int ssh_handle_packets(ssh_session session, int timeout) {
* (-1) means an infinite timeout.
* Specifying SSH_TIMEOUT_USER means to use the timeout
* specified in options. 0 means poll will return immediately.
+ * SSH_TIMEOUT_DEFAULT uses blocking parameters of the session.
* This parameter is passed to the poll() function.
*
* @param[in] fct Termination function to be used to determine if it is
@@ -530,6 +531,11 @@ int ssh_handle_packets_termination(ssh_session session, int timeout,
session->opts.timeout_usec);
else
timeout = SSH_TIMEOUT_NONBLOCKING;
+ } else if (timeout == SSH_TIMEOUT_DEFAULT){
+ if(ssh_is_blocking(session))
+ timeout = SSH_TIMEOUT_INFINITE;
+ else
+ timeout = SSH_TIMEOUT_NONBLOCKING;
}
ssh_timestamp_init(&ts);
tm = timeout;