Subject: Re: [ libssh2-Bugs-2558794 ] libssh2_poll returns 0 sometimes when using select

Re: [ libssh2-Bugs-2558794 ] libssh2_poll returns 0 sometimes when using select

From: Heiner Steven <>
Date: Wed, 15 Apr 2009 14:59:39 +0200 wrote:

> Bugs item #2558794, was opened at 2009-02-03 01:14
> Message generated for change (Comment added) made by bagder
> You can respond by visiting:

>> Comment By: Daniel Stenberg (bagder)
> Date: 2009-04-05 20:29
> Message:
> I'm now advocating we deprecate libssh2_poll() completely.
> Is there any reason why you don't just use poll() or select() on the
> socket libssh2 operates on?

According to the manual page libssh2_poll() seems to be just a
platform-independant wrapper to poll(2)/select(2).

We could, however, add some additional value to that function: it
could return whether a *complete SSH message* has been read or even
if *SSH data* is available for libssh2_channel_read_ex().

In this case a programmer could use the low-level poll()/select()
of his operating system to find out if there is any data available
at all, and the SSH-level libssh2_poll() if there is a complete
message at the SSH protocol level.

Both could return different results: if e.g. one byte has been
received from the socket, poll(2) may return TRUE (there is data
available), but libssh2_poll() could return FALSE (there is no
complete SSH message to be processed).

The exact semantics would be for us to define. We have at least
the following possibilities:

  o Some data is available (this is the way it is used now)
  o A complete SSH-Message is available
  o SSH (user) data is available


This email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
libssh2-devel mailing list
Received on 2009-04-15