doc/designs/ddd/ddd-05-mem-nonblocking.c
/*
 * Non-blocking transmission.
 *
 * Returns -1 on error. Returns -2 if the function would block (corresponds to
 * EWOULDBLOCK).
 */
Non-blocking transmission.
Returns -1 on error. Returns -2 if the function would block (corresponds to
EWOULDBLOCK).
Non - blocking transmission . Returns - 1 on error . Returns - 2 if the function would block ( corresponds to EWOULDBLOCK ) .
int tx(APP_CONN *conn, const void *buf, int buf_len)
{
    int rc, l;
    l = BIO_write(conn->ssl_bio, buf, buf_len);
    if (l <= 0) {
        rc = SSL_get_error(conn->ssl, l);
        switch (rc) {
            case SSL_ERROR_WANT_READ:
                conn->tx_need_rx = 1;
            case SSL_ERROR_WANT_CONNECT:
            case SSL_ERROR_WANT_WRITE:
                return -2;
            default:
                return -1;
        }
    } else {
        conn->tx_need_rx = 0;
    }
    return l;
}
int tx ( APP_CONN * conn , const void * buf , int buf_len ) { int rc , l ; l = BIO_write ( conn -> ssl_bio , buf , buf_len ) ; if ( l <= 0 ) { rc = SSL_get_error ( conn -> ssl , l ) ; switch ( rc ) { case SSL_ERROR_WANT_READ : conn -> tx_need_rx = 1 ; case SSL_ERROR_WANT_CONNECT : case SSL_ERROR_WANT_WRITE : return -2 ; default : return -1 ; } } else { conn -> tx_need_rx = 0 ; } return l ; }
Non-blocking transmission.
Non - blocking transmission .