On Apr 22, 2007, at 12:55 PM, Daniel Stenberg wrote: > On Sun, 22 Apr 2007, James Housley wrote: > >> That and there is a long way/time to go until all the functions >> exist in both modes. In the mean time, if the current blocking >> state of the socket were detected and channel->blocking was set by >> then, existing programs should continue to work with the new >> versions of the library. > > Sorry, but I'm not following. > > I see two different ways to do the API > > 1) We have libssh2_channel_set_blocking() and it controls *ALL* > functions to > do blocking or non-blocking. This didn't work before, and I > didn't take > this route when I started to add *nb() functions.
You are correct it did not work before, and creating *nb() functions make it very easy to slowly migrate to our goal of working fully in both blocking and non-blocking mode. In the end I personally think it might be better to only have one, but we can all debate that once all the work is done, because right now we need both. > > 2) We have a set of *nb() functions for non-blocking operations. > Why the need > for libssh2_channel_set_blocking() then? Right now an existing program works with libssh2 and uses the non- blocking functions, lets only talk about libssh2_sftp_read(). After calling libssh2_sftp_read() libssh will be told it is in non-blocking mode, because at startup the library wasn't set to blocking (because the function didn't exist before). Later on the program calls libssh2_channel_close() or similar, but now instead returning -1 on failure and 0 on success -2 (*_EAGAIN) will be returned. The calling program will think this is a error and abort. This is bacause the "non-blocking" sftp functions set the libssh2 library into non-blocking mode, when it shouldn't be. Basically functionality has been changed in a subtle way that will cause programs to break. > > Are you saying you want libssh2_channel_set_blocking() to remain > since we don't yet have all the *nb() functions we want and that > the function actually make some of the non-*nb() functions non- > blocking? I am saying the library has to know for sure if it is in blocking or non-blocking mode. This can be done with the added libssh2_channel_set_blocking() function, but this won't help existing programs. Or, the new function I proposed can be added so libssh2 just figures it out for itself. Jim -- /"\ ASCII Ribbon Campaign . \ / - NO HTML/RTF in e-mail . X - NO Word docs in e-mail . / \ ----------------------------------------------------------------- [EMAIL PROTECTED] http://www.FreeBSD.org The Power to Serve [EMAIL PROTECTED] http://www.TheHousleys.net --------------------------------------------------------------------- A: Yes. | Q: Are you sure? | | A: Because it reverses the logical flow of conversation. | | | Q: Why is top posting frowned upon? ------------------------------------------------------------------------- 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel