aboutsummaryrefslogtreecommitdiff
path: root/libssh/session.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-01-08 23:05:10 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2010-01-08 23:05:10 +0100
commit514ab6eed2b520d14a1dce783e3180db11f460a4 (patch)
treea17bcf8d1fbf2e042e33062415d0125c300e1ae1 /libssh/session.c
parentc41e3a8e68322e7cfea7afb6160b8af285f6ab47 (diff)
downloadlibssh-514ab6eed2b520d14a1dce783e3180db11f460a4.tar.gz
libssh-514ab6eed2b520d14a1dce783e3180db11f460a4.tar.xz
libssh-514ab6eed2b520d14a1dce783e3180db11f460a4.zip
Fixed blocking bug in channel_poll
Diffstat (limited to 'libssh/session.c')
-rw-r--r--libssh/session.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libssh/session.c b/libssh/session.c
index adb4191..0fdef97 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -265,9 +265,13 @@ void ssh_set_fd_except(ssh_session session) {
* @brief polls the current session for an event and call the
* appropriate callbacks. Will block until one event happens.
* @param session session handle.
+ * @param timeout An upper limit on the time for which
+ * ssh_handle_packets() will block, in milliseconds.
+ * Specifying a negative value means an infinite timeout.
+ * This parameter is passed to the poll() function.
* @return SSH_OK if there are no error, SSH_ERROR otherwise.
*/
-int ssh_handle_packets(ssh_session session) {
+int ssh_handle_packets(ssh_session session, int timeout) {
ssh_poll_handle spoll;
ssh_poll_ctx ctx;
if(session==NULL || session->socket==NULL)
@@ -279,7 +283,7 @@ int ssh_handle_packets(ssh_session session) {
ctx=ssh_get_global_poll_ctx(session);
ssh_poll_ctx_add(ctx,spoll);
}
- ssh_poll_ctx_dopoll(ctx,-1);
+ ssh_poll_ctx_dopoll(ctx,timeout);
leave_function();
if (session->session_state != SSH_SESSION_STATE_ERROR)
return SSH_OK;