Hello all!
 
i spent weekend investigating why my server
do not cache client sessions in memory cache ;)).
The result was that server do NOT cache sessions if
it doesn't got close notify from client.
So to make ir work need whether to make graceful
disconnect or define received shutdown flag forcedly setting
SSL_set_shutdown(conn->ssl, SSL_RECEIVED_SHUTDOWN);
 
I take a look in mod_ssl - according to source comments
they afraid of shutdown function (deadloop) and use the folowing
disconnect approach:
 
   /* try to gracefully shutdown the connection:
   * - send an own shutdown message (be gracefully)
   * - don't wait for peer's shutdown message (deadloop)
   * - kick away the SSL stuff immediately
   */
   SSL_set_shutdown(conn->ssl, SSL_RECEIVED_SHUTDOWN);
   SSL_smart_shutdown(conn->ssl);
   SSL_free(conn->ssl);
 
where SSL_smart_shutdown() is:
 
int SSL_smart_shutdown(SSL *ssl) {
    int i;  int rc = 0;
    for (i = 0; i < 4; i++) { //max 2x pending + 2x data = "">        if ((rc = SSL_shutdown(ssl)))
            break;
    }
    return rc;
}
 
The question actually is - is there any certain recomendations on
how it should be done properly?
Or it always depends on protocol, what side initiate connection closing first etc.
 
 
 

Reply via email to