> Well, that is not true and I am sorry I did not give
> you the full code as it is quite complicated but the
> snipet you see above is called after  a new  connection
> is already accepted. So I have an outer loop that does
> a select and once a new connection is detected and accepted
> without errors, I go ahead establishing the ssl part... Something like:

      ready_sockets = ::select(m_max_socket + 1, rfds, 0, 0,&tv);
      if (ready_sockets > 0)
      {
         if (FD_ISSET(s->get_sock(),p->get_rfds()))
         {
            new_s->set_non_blocking(true);
            if (s->accept(new_s))
            {
                       call the code above which will call SSL_accept
            }
            else
            {
             /*error handling*/
            }

Where is the call to 'accept' (the system's 'accept')? Did you cut out a
line before 'new_s->set_non_blocking'? Is 's->accept(new_s)' a wrapper
around 'accept'? Can you paste the code to this wrapper?

> I am setting the socket as non blocking by simply calling:

                if (fcntl(m_sock_fd, F_SETFL, O_NONBLOCK) == -1)
                {
                        return false;
                }

This does not make the BIO non-blocking. That may or may not matter, but to
tell I need to see where the actual call to the system's 'accept' function
is taking place. And you still haven't pasted that code.

> I am confused when you say if my BIO is non-blocking too.
> I thought that it is non blocking since the underlying socket
> is non blocking. Is this a wrong assumption? if so how can I make
> the BIO non blocking [BIO_set_nbio?]

Right. A blocking BIO with a non-blocking socket can cause serious problems.

Where is the actual call to 'accept' to accept the connection? What happens
if 'accept' returns EMFILE or ENFILE?

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to