Subject: [libssh2] Confusing *_EAGAIN error codes

[libssh2] Confusing *_EAGAIN error codes

From: James Housley <jim_at_thehousleys.net>
Date: Fri, 8 Jun 2007 08:12:32 -0400

Internally libssh2 uses PACKET_EAGAIN(-2) to signal would block.
Externally:

Functions that return a structure return NULL and set error to
LIBSSH2_ERROR_EAGAIN(-37)

Functions that return "int" return either LIBSSH2CHANNEL_EAGAIN(-2)
or LIBSSH2SFTP_EAGAIN(-2), EXCEPT for
libssh2_session_startup() and libssh2_session_disconnect_ex() which
return LIBSSH2_ERROR_EAGAIN(-37).

libssh2_session_disconnect_ex()'s return of LIBSSH2_ERROR_EAGAIN(-37)
is incorrect, it should return -2.

libssh2_session_startup() returns other LIBSSH2_ERROR_ values so it
should return LIBSSH2_ERROR_EAGAIN.

Some of the public functions are called by other public or private
functions so they have to use the same value.

LIBSSH2CHANNEL_EAGAIN and LIBSSH2SFTP_EAGAIN were defined as part of
the conversion to non-blocking as an initial way to tell functionality.

To simplify the users error interface I am suggesting that
PACKET_EAGAIN, LIBSSH2CHANNEL_EAGAIN and LIBSSH2SFTP_EAGAIN all be
defined to be LIBSSH2_ERROR_EAGAIN.

Comments

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-devel
Received on 2007-06-08