Hi,
first of all, thank you for this good SSH library. That's a pretty good
piece of software :-)
Now I have a question.
In the libssh2 examples I can see this :
while ((rc = libssh2_session_startup(session, sock)) ==
LIBSSH2_ERROR_EAGAIN);
if (rc) {
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
return -1;
}
That's fine for an example, but in some real cases it's going to consume
lots of CPU cycles for nothing.
So what I want to do is to poll for new data in the loop instead of
immediately returning, something like :
while ((rc = libssh2_session_startup(session, sock)) ==
LIBSSH2_ERROR_EAGAIN)
{
ps = poll(&fds, 1, timeout);
if (ps == -1)
{
// handle error
}
else if (ps == 0)
{
// handle timeout
}
}
The problem with this is that I do not know if I have to POLLIN or POLLOUT.
What should I do ? Poll for both ?
NB : OpenSSL solved this by having two return codes :
SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE
-- Rodolphe _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2011-06-15