Richard F. Ostrow Jr. wrote:

>                         if((n = select(nfds + 1, &rfds, NULL, NULL, NULL))
> < 0)
>                         {

[snip]

>                         for(sbiotmp = client_head; sbiotmp; sbiotmp =
> sbiotmp->next)
>                         {
>                                 if(FD_ISSET(sbiotmp->sock, &rfds))
>                                 {
>                                         if(BIO_read(sbiotmp->bio, buffer,
> 1) <= 0)
>                                         {

        You can't use an SSL BIO that way. There is not a one-to-one 
correspondence
between blocks received from the network and blocks received from the BIO.
The most obvious way this can fail -- the data has already been received
from the network by the time you call 'select', so you're waiting for data
that has already arrived.

        It's not the problem you're having now, but perhaps if you fix your 
server,
this problem will go away too.

        The correct approach to an SSL connection is:

1) If you want to read data from it, simply try to read data from it. (The
data may already be available.)

2) If you get a 'cannot make progress until data arrives' indication, *then*
add it to your 'select' set.

3) Any forward progress invalidates your 'cannot make progress' indication.
The send and receive paths are not logically indepedent.

        DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to