$SERVER = IO::Socket::SSL->new( Proto => 'tcp',
LocalPort => $LISTEN_PORT,
Listen => 5,
ReuseAddr => 1,
%ssl_opts,
);
####
while(4)
{
last if $break_main_loop;
my $CLIENT = $SERVER->accept();
if( ! $CLIENT )
{
rcd_log( "fatal: $SERVER_SSL_TRAP_ERROR" ) if $opt_ssl and $SERVER_SSL_TRAP_ERROR;
next;
}
my $peerhost = $CLIENT->peerhost();
my $peerport = $CLIENT->peerport();
my $sockhost = $CLIENT->sockhost();
my $sockport = $CLIENT->sockport();
rcd_log( "info: connection from $peerhost:$peerport to $sockhost:$sockport (me)" );
# do the rest
####
SSL_session_cache_size
If you make repeated connections to the same host/port and the SSL renegotiation time is an issue, you can turn on client-side session caching with this option by specifying a positive cache size. For successive connections, pass the SSL_reuse_ctx option to the new() calls (or use set_default_context()) to make use of the cached sessions. The session cache size refers to the number of unique host/port pairs that can be stored at one time; the oldest sessions in the cache will be removed if new ones are added.
SSL_session_cache
Specifies session cache object which should be used instead of creating a new. Overrules SSL_session_cache_size. This option is useful if you want to reuse the cache, but not the rest of the context.
A session cache object can be created using IO::Socket::SSL::Session_Cache->new( cachesize ).
Use set_default_session_cache() to set a global cache object.
####
openssl s_client -reconnect -state -prexit -connect localhost:443 -cert testpkey.pem