r=(SSL_SESSION *)lh_retrieve(s->ctx->sessions, (char *)ss);
r=(SSL_SESSION *)lh_retrieve(s->ctx->sessions, ss);
int ssl_get_new_session(SSL *s, int session)	{	/* This gets used by clients and servers. */	SSL_SESSION *ss=NULL;	if ((ss=SSL_SESSION_new()) == NULL) return(0);	/* If the context has a default timeout, use it */	if (s->ctx->session_timeout == 0)		ss->timeout=SSL_get_default_timeout(s);	else		ss->timeout=s->ctx->session_timeout;	if (s->session != NULL)		{		SSL_SESSION_free(s->session);		s->session=NULL;		}	if (session)		{		if (s->version == SSL2_VERSION)			{			ss->ssl_version=SSL2_VERSION;			ss->session_id_length=SSL2_SSL_SESSION_ID_LENGTH;			}		else if (s->version == SSL3_VERSION)			{			ss->ssl_version=SSL3_VERSION;			ss->session_id_length=SSL3_SSL_SESSION_ID_LENGTH;			}		else if (s->version == TLS1_VERSION)			{			ss->ssl_version=TLS1_VERSION;			ss->session_id_length=SSL3_SSL_SESSION_ID_LENGTH;			}		else			{			SSLerr(SSL_F_SSL_GET_NEW_SESSION,SSL_R_UNSUPPORTED_SSL_VERSION);			SSL_SESSION_free(ss);			return(0);			}		for (;;)			{			SSL_SESSION *r;			RAND_pseudo_bytes(ss->session_id,ss->session_id_length);			CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);			r=(SSL_SESSION *)lh_retrieve(s->ctx->sessions,				(char *)ss);			CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);			if (r == NULL) break;			/* else - woops a session_id match */			/* XXX We should also check the external cache --			 * but the probability of a collision is negligible, and			 * we could not prevent the concurrent creation of sessions			 * with identical IDs since we currently don't have means			 * to atomically check whether a session ID already exists			 * and make a reservation for it if it does not			 * (this problem applies to the internal cache as well).			 */			}		}	else		{		ss->session_id_length=0;		}	memcpy(ss->sid_ctx,s->sid_ctx,s->sid_ctx_length);	ss->sid_ctx_length=s->sid_ctx_length;	s->session=ss;	ss->ssl_version=s->version;	ss->verify_result = X509_V_OK;	return(1);	}