On Fri December 9 2011, MK wrote: > On Fri, 9 Dec 2011 07:55:07 -0600 > "Michael S. Zick" <open...@morethan.org> wrote: > > > Evidently your connection is doing a renegotiation during the > > transfer. You missed: > > http://stackoverflow.com/questions/3952104/how-to-handle-openssl-ssl-error-want-read-want-write-on-non-blocking-sockets > > > > Among a few other zillion posts that google can find on the subject. > > What makes you believe I am not handling this correctly? If the the > call returns WANT_WRITE or WANT_READ, it gets called again with > exactly the same parameters, which is exactly what that and all those > other zillion posts recommend. This is why I set the err to EAGAIN, > because the same thing must be done with a regular non-blocking socket. >
Because the write action might return __either__ want_read or want_write and the read action might return __either__ want_read or want_write. Just because the most current action was a "write" does not mean you can presume the return was "want_write" - it might be "want_read". The same is true if the most current action was a "read". The OpenSSL layer is a state machine, you can't turn a four state machine into a two state machine by folding the distinctive returns into a single return, at least not if you expect it to work. ;-) Mike > I've even tried using a global buffer in place of the stack one, just > to be sure the repeated call really uses "exactly the same args", which > is in the man page -- this did not make any difference. > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org