Before I continue on this path I would feel better if my methodology was reviewed. I started with the functions that call send(2) and recv (2). Then worked up to the functions that call them directly and made them reentrant for non-blocking. Some functions I added a variable to the argument list the stores the state and others I put the state in LIBSSH2_SESSION *session. When I was positive of the calling sources it went in to *session. Some that didn't go in yet probably can and will go in later. There are two text files in the root of the source that I have been using to help track my progress, I believe they are up to date.
Right now libssh2_session_startup() is the only fully reentrant non- blocking function I have done. I have some concerns about this style, but I don't know a different method. Some of the functions allocate memory from the heap, which I had to add to the state so they could be maintained across calls. In blocking mode there are not problems. In non-blocking mode there are no problems if the library function, libssh2_session_startup() for example, is called again when LIBSSH2_ERROR_EAGAIN is returned until an error is encountered or success. Both an error and success will properly free all memory. However, if the users program decides to stop retrying the function because it has been taking too long two things happen. First, all the active states won't be returned to idle. Secondly, if there was memory allocated it won't be freed. My current code is available for download at http:// www.thehousleys.net/libssh2_NB_initial.zip I have been doing testing with examples/simple/test_sftp.sh and examples/simple/test_sftp_nonblock.sh , those two have been updated to meet some new requirements. 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 --------------------------------------------------------------------- Q: Because it reverses the logical flow of conversation. A: Why is putting a reply at the top of the message 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