From: Vincent Levesque <[EMAIL PROTECTED]>:

> I'm using a bio pair combined with an ssl_f_bio, just as in
> /test/ssltest.c in the recent snapshots. I'm looking for a way to do a
> select() or something similar on the bio pair. I looked around and I
> didn't find much information about that or about bio's in general. Any
> suggestions?

As both ends of a BIO pair are supposed to be handled by the same
thread, it does not make sense to use select() on them directly.
BIO pairs are always non-blocking (obviously, given that any blocking
would be a deadlock), and the application can see itself when it
resolves the equivalent of an "EWOULDBLOCK" condition.

If an application relays data between the network and one end of the
BIO pair, it can make sense to use select() or similar for that I/O
interface: Assuming that you use SSL on one end of the BIO pair and
have I/O on the other, then if the SSL library says
SSL_ERROR_WANT_READ, you have to feed some data into the I/O end of
the BIO pair, which may imply the need to do a select().  You don't
have to pay attention to SSL_ERROR_WANT_WRITE, however; instead use
BIO_ctrl_get_pending on the I/O end of the BIO pair to find out
whether data is available for writing.  If there is some, you always
have to send it over the network -- any SSL_ERROR_WANT_WRITE condition
that may have existed will go away when you do so.

(You also do not really have to pay attention to SSL_ERROR_WANT_READ
-- just as well you might look at BIO_ctrl_get_read_request at the I/O
end of the BIO pair to check whether the SSL library tried to read
some data that was not there.  This function also tells you how many
bytes the SSL library needs, so that its return value can be used as
the byte-count parameter for whatever function you use to read from
the network.)
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to