Subject: Re: [PATCH] Timeout support for blocking API

Re: [PATCH] Timeout support for blocking API

From: Jan Van Boghout <lists_at_macrabbit.com>
Date: Thu, 10 Jun 2010 13:29:09 +0200

The goal of the patch was to time out properly when a connection becomes unresponsive. As it is, libssh2 sometimes just blocks indefinitely waiting for the server to respond -- causing the host app to block its libssh2/SFTP thread as well and making proper higher-level timeout handling impossible. If the server is still responding, the timeout should indeed just cause it to loop back, which is desirable behavior in our case (reading/writing for SFTP).

Cheers,
Jan

> On Tue, 16 Feb 2010, Jan Van Boghout wrote:
>
>> These patches are a proposal for a user-customizable timeout value when interacting with sessions in blocking mode. See the following comment in session.c: /* Note that this COULD be made to use a timeout that perhaps could be customizable by the app or something... */
>
> I'd like to come back to the discussion about this patch. See http://www.libssh2.org/mail/libssh2-devel-archive-2010-02/0073.shtml for the original post.
>
> I think apps could use a way to set a maximum time that libssh2 would wait.
>
> One question is what the given time is, like is it total time for the entire function call, or just maximum time for a single select() call (which seems a bit strange to set from an app's viewpoint). Another question is if Jan Van Boghout's patch actually works, as I would suspect that just having select() return will in many cases just have libssh2 call the same function again and it'll loop back into the select() really quickly...
>
> Thoughts?
>
> --
>
> / daniel.haxx.se

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-06-10