s->ctx->sess_cb_hit++;
s->ctx->stats.sess_cb_hit++;
int ssl_get_prev_session(s,session_id,len)SSL *s;unsigned char *session_id;int len;	{	SSL_SESSION *ret=NULL,data;	/* conn_init();*/	data.ssl_version=s->version;	data.session_id_length=len;	if (len > SSL_MAX_SSL_SESSION_ID_LENGTH)		return(0);	memcpy(data.session_id,session_id,len);;	if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_LOOKUP))		{		CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);		ret=(SSL_SESSION *)lh_retrieve(s->ctx->sessions,(char *)&data);		CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);		}	if (ret == NULL)		{		int copy=1;		s->ctx->sess_miss++;		ret=NULL;		if ((s->ctx->get_session_cb != NULL) &&			((ret=s->ctx->get_session_cb(s,session_id,len,&copy))				!= NULL))			{			s->ctx->sess_cb_hit++;			/* The following should not return 1, otherwise,			 * things are very strange */			SSL_CTX_add_session(s->ctx,ret);			/* auto free it */			if (!copy)				SSL_SESSION_free(ret);			}		if (ret == NULL) return(0);		}	if (ret->cipher == NULL)		{		char buf[5],*p;		unsigned long l;		p=buf;		l=ret->cipher_id;		l2n(l,p);		if ((ret->ssl_version>>8) == SSL3_VERSION_MAJOR)			ret->cipher=ssl_get_cipher_by_char(s,&(buf[2]));		else 			ret->cipher=ssl_get_cipher_by_char(s,&(buf[1]));		if (ret->cipher == NULL)			return(0);		}	/* If a thread got the session, then 'swaped', and another got	 * it and then due to a time-out decided to 'Free' it we could	 * be in trouble.  So I'll increment it now, then double decrement	 * later - am I speaking rubbish?. */	CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);	if ((long)(ret->time+ret->timeout) < (long)time(NULL)) /* timeout */		{		s->ctx->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++;	/* ret->time=time(NULL); */ /* rezero timeout? */	/* again, just leave the session 	 * if it is the same session, we have just incremented and	 * then decremented the reference count :-) */	if (s->session != NULL)		SSL_SESSION_free(s->session);	s->session=ret;	return(1);	}