The current code is available at http://www.thehousleys.net/
libssh2_NB_initial.zip
I am nearly done with the code. Right now, as far as I know, all the
routines in session, packet, kex, userauth, publickey and scp
routines are fully non-blocking capable. All the channel routines
except for libssh2_channel_read_ex() are done. That one is a little
complex and I keep looking at it and putting it off. In a couple of
routings I found that "goto" was the best solution.
There have been no significant changes to the API yet. I added:
LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL
*channel, int ignore_mode)
LIBSSH2_API int libssh2_session_last_errno(LIBSSH2_SESSION *session)
libssh2_channel_handle_extended_data2() is a non-blocking version of
libssh2_channel_handle_extended_data()
libssh2_session_last_errno() make it much easier to check the last
error if you only care about the error number. This is needed for
calls like libssh2_channel_open_ex() that return a channel
structure. libssh2_channel_open_ex() no set the error to
LIBSSH2_ERROR_EAGAIN and return NULL. So in non-blocking a code
segment like this could be used:
channel = libssh2_channel_open_ex(session, ......);
if (!channel) {
if (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
/* previous call set libssh2_session_last_error(), pass it
through */
LIBSSH2_FREE(session, session->scpSend_command);
return NULL;
}
else if (libssh2_session_last_errno(session) ==
LIBSSH2_ERROR_EAGAIN) {
libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block
starting up channel", 0);
return NULL;
}
}
Still to do is libssh2_channel_read_ex() and the sftp subsystem. The
last part will be the documentation
Jim
-- /"\ ASCII Ribbon Campaign . \ / - NO HTML/RTF in e-mail . X - NO Word docs in e-mail . / \ ----------------------------------------------------------------- jeh@FreeBSD.org http://www.FreeBSD.org The Power to Serve jim@TheHousleys.Net http://www.TheHousleys.net --------------------------------------------------------------------- In theory there is no difference between theory and practice. In practice there is no similarity. -- From the "I wish I'd said that" archives. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ libssh2-devel mailing list libssh2-devel_at_lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-develReceived on 2007-06-04