I'm trying to do nonblocking writes via OpenSSL.  Initially I cribbed the
following from mod_ssl:

        int iostate = 1;
        rv = ioctl(sock, FIONBIO, (u_long*)&iostate);
        rv = SSL_write(ssl, (char*)buf, len);
        ...
        iostate = 0;
        ioctl(sock, FIONBIO, (u_long*)&iostate);

But doing a 4kB write, followed by a ~30kB one, the second attempt would
consistently fail to write and get -1 back from SSL_write().

If I replace the ioctl() calls with fcntl() calls that should be equivalent,
it works every time.  That is, set nonblocking as follows:

        iostate = fcntl(sock, F_GETFL, 0);
        iostate |= O_NDELAY;
        rv = fcntl(sock, F_SETFL, iostate);

Why do I get different results here?  I dug through the openssl code a bit
and can't see where this should make a difference.  Buggy ioctl function,
maybe?

-- 
Tom Harrington
Cybernetic Entomologist
EMC Colorado Springs
[EMAIL PROTECTED]


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to