Subject: Re: timeouts in libssh2 blocking-mode

Re: timeouts in libssh2 blocking-mode

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 3 May 2011 14:24:23 +0200 (CEST)

On Tue, 3 May 2011, Matt Lilley wrote:

I like it! I only have this little thought. The patch has this section:

+ if (seconds_to_next > 0) {
+ tv.tv_sec = seconds_to_next;
+ tv.tv_usec = 0;
+ has_timeout = 1;
+ } else if (session->api_timeout > 0) {
+ time_t now = time (NULL);
+ long elapsed_ms = (long)(1000*difftime(start_time, now));

... which then basically makes it _not_ obey the timeout if there's a
keep-alive timeout in action, which I'm not sure is desirable. Just because
there's a possible keep-alive timer firing off in the future doesn't mean your
timeout is no longer valid.

I think the maximum time allowed to select() should also affect the timeout
even if seconds_to_next is non-zero.

Thoughts?

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-05-03