summaryrefslogtreecommitdiffstats
path: root/src/session.c
diff options
context:
space:
mode:
authorOliver Stöneberg <oliverst@online.de>2011-05-16 06:49:38 -0700
committerAndreas Schneider <asn@cryptomilk.org>2011-05-17 14:21:04 +0200
commit671a9827394714cfc90d75c8a8fb2ccd86f80abf (patch)
tree1dfceab719c98de0c89d663914b8d159da3e8b72 /src/session.c
parent4e153aed8a943b636135b424e052fc69392ad87c (diff)
downloadlibssh-671a9827394714cfc90d75c8a8fb2ccd86f80abf.tar.gz
libssh-671a9827394714cfc90d75c8a8fb2ccd86f80abf.tar.xz
libssh-671a9827394714cfc90d75c8a8fb2ccd86f80abf.zip
connect: Set timeout on connect
This also fixes error handling in ssh_poll_ctx_dopoll() and ssh_handle_packets(), so it won't loop forever on an actual timeout.
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/session.c b/src/session.c
index 18688c6..35fb0b2 100644
--- a/src/session.c
+++ b/src/session.c
@@ -429,7 +429,8 @@ int ssh_handle_packets(ssh_session session, int timeout) {
if(spoll_in != spoll_out)
ssh_poll_ctx_add(ctx,spoll_out);
}
- ssh_poll_ctx_dopoll(ctx,timeout);
+ if( ssh_poll_ctx_dopoll(ctx,timeout) )
+ session->session_state = SSH_SESSION_STATE_ERROR;
leave_function();
if (session->session_state != SSH_SESSION_STATE_ERROR)
return SSH_OK;