ss->time=time(NULL);
ss->prev=NULL;
ss->next=NULL;
+ ss->compress_meth=0;
CRYPTO_new_ex_data(ssl_session_meth,(char *)ss,&ss->ex_data);
return(ss);
}
if ((ss=SSL_SESSION_new()) == NULL) return(0);
/* If the context has a default timeout, use it */
- if (s->ctx->session_timeout != 0)
+ if (s->ctx->session_timeout == 0)
ss->timeout=SSL_get_default_timeout(s);
+ else
+ ss->timeout=s->ctx->session_timeout;
if (s->session != NULL)
{
{
int copy=1;
- s->ctx->sess_miss++;
+ s->ctx->stats.sess_miss++;
ret=NULL;
if ((s->ctx->get_session_cb != NULL) &&
((ret=s->ctx->get_session_cb(s,session_id,len,©))
!= NULL))
{
- s->ctx->sess_cb_hit++;
+ s->ctx->stats.sess_cb_hit++;
/* The following should not return 1, otherwise,
* things are very strange */
if ((long)(ret->time+ret->timeout) < (long)time(NULL)) /* timeout */
{
- s->ctx->sess_timeout++;
+ s->ctx->stats.sess_timeout++;
/* remove it from the cache */
SSL_CTX_remove_session(s->ctx,ret);
SSL_SESSION_free(ret); /* again to actually Free it */
return(0);
}
- s->ctx->sess_hit++;
+ s->ctx->stats.sess_hit++;
/* ret->time=time(NULL); */ /* rezero timeout? */
/* again, just leave the session
ctx->session_cache_tail))
break;
else
- ctx->sess_cache_full++;
+ ctx->stats.sess_cache_full++;
}
}
}
{
if (!SSL_set_ssl_method(s,meth))
return(0);
- session->timeout=SSL_get_default_timeout(s);
+ if (s->ctx->session_timeout == 0)
+ session->timeout=SSL_get_default_timeout(s);
+ else
+ session->timeout=s->ctx->session_timeout;
}
/* CRYPTO_w_lock(CRYPTO_LOCK_SSL);*/
SSL_SESSION_free(s->session);
s->session=NULL;
}
+
+ meth=s->ctx->method;
+ if (meth != s->method)
+ {
+ if (!SSL_set_ssl_method(s,meth))
+ return(0);
+ }
+ ret=1;
}
return(ret);
}
return(t);
}
+long SSL_CTX_set_timeout(s,t)
+SSL_CTX *s;
+long t;
+ {
+ long l;
+ if (s == NULL) return(0);
+ l=s->session_timeout;
+ s->session_timeout=t;
+ return(l);
+ }
+
+long SSL_CTX_get_timeout(s)
+SSL_CTX *s;
+ {
+ if (s == NULL) return(0);
+ return(s->session_timeout);
+ }
+
typedef struct timeout_param_st
{
SSL_CTX *ctx;
TIMEOUT_PARAM tp;
tp.ctx=s;
- tp.cache=SSL_CTX_sessions(s);
+ tp.cache=s->sessions;
if (tp.cache == NULL) return;
tp.time=t;
CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);