Daniel Stenberg <[EMAIL PROTECTED]> writes: > On Tue, 1 Jul 2008, J.T. Conklin wrote: > >> I checked the current CVS version of sftp.c, and it looks like more >> effort has been made to make libssh2_sftp_close_handle() return >> PACKET_EAGAIN when an underlying libssh_* operation fails with >> PACKET_EAGAIN. I'm not sure what benefit this is supposed to >> provide. It seems to push error handling for nonblocking >> connections up to the client, so what was a >> "libssh2_sftp_close_handle(h);" has to be changed to >> "while(libssh2_sftp_close_handle(h) != PACKET_EAGAIN);". >> >> I really think this libssh2_sftp_close_handle() needs to be changed >> to be best effort and blocking > > Why so? We've made an effort to bring non-blocking functionality to > libssh2, why would an application using libssh2 suddenly not care > about that when it wants to close a SFTP handle?
I suggested blocking because it seems conceptually simpler. After you close a handle, there's nothing more that can be done with it, as such it seemed natural to have close() block until it has completed? Now I suspect this opinion was formed due to my lack of direct experience with non-blocking I/O -- I usually use blocking or asynchronous I/O. I did a little investigating, and saw that OpenSSL's SSL_shutdown(), which is roughly equivalent in a handwavy kind of way, also returns a "partially done" value when the BIO is in nonblocking mode. It seems that libssh2's behavior isn't as wierd as I first thought, and I'll take that suggestion off the table (and we can all pretend I never made it in the first place :-). But if there is a hard failure, as in the case of the underlying connection being closed, I think libssh2_sftp_close_handle() has to complete, as no amount of retries are going to complete the close. --jtc -- J.T. Conklin ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel