Hi,

My application tries to make multiple SSL  connections to a server in a
persistent TCP Connection. The client will establish for once a TCP
connection and later on attempt n number of SSL connections in the same TCP
connection.

In  a particular case where the client times out ['select' is used]  while
reading a particular data from the server, the client would do SSL_shutdown
and try the next round of connection. In the subsequent cycle , I observe
that the SSL handshakes fails with select timing out.

The following snippet indicates how client does the SSL_connect.


   //..

    err = SSL_connect (ssl);

    struct timeval l_connect_timeout;
    int l_fds;
    l_connect_timeout.tv_usec=0;
    l_connect_timeout.tv_sec=30;
    while(1)
    {
        if(err == -1)
        {
            if(l_ssl_err_code == SSL_ERROR_WANT_READ || l_ssl_err_code ==
SSL_ERROR_WANT_WRITE)
            {
                cout << "SSL Handshake in Progress "<<endl;
                l_fds=select(sd+1, &filedes_set,NULL,NULL,
&l_connect_timeout);
                if(l_fds == 0)
                {
                   cerr<<"Could not complete SSL Handshake within 30
secs"<<endl;
                   return 0;
                }

                //.....
                //....
 }
    }
I observe that the 'select' returns 0 after 30 seconds. From the ethereal it
is seen that the
client sends the 'Client Key Exchange' after 30 seconds after it recieves
'Server Hello'.

In non persistent connections the issue is not observed.And if there is no
timeouts during the
data exchange there are no issues as well.

 Any comments?

Regards,

Prabhu. S

Reply via email to