s->ctx->sess_connect++;
s->ctx->stats.sess_connect++;
int ssl23_connect(s)SSL *s;	{	BUF_MEM *buf;	unsigned long Time=time(NULL);	void (*cb)()=NULL;	int ret= -1;	int new_state,state;	RAND_seed(&Time,sizeof(Time));	ERR_clear_error();	clear_sys_error();	if (s->info_callback != NULL)		cb=s->info_callback;	else if (s->ctx->info_callback != NULL)		cb=s->ctx->info_callback;		if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); 	s->in_handshake++;	for (;;)		{		state=s->state;		switch(s->state)			{		case SSL_ST_BEFORE:		case SSL_ST_CONNECT:		case SSL_ST_BEFORE|SSL_ST_CONNECT:		case SSL_ST_OK|SSL_ST_CONNECT:			if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);			/* s->version=TLS1_VERSION; */			s->type=SSL_ST_CONNECT;			if (s->init_buf == NULL)				{				if ((buf=BUF_MEM_new()) == NULL)					{					ret= -1;					goto end;					}				if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))					{					ret= -1;					goto end;					}				s->init_buf=buf;				}			if (!ssl3_setup_buffers(s)) { ret= -1; goto end; }			ssl3_init_finished_mac(s);			s->state=SSL23_ST_CW_CLNT_HELLO_A;			s->ctx->sess_connect++;			s->init_num=0;			break;		case SSL23_ST_CW_CLNT_HELLO_A:		case SSL23_ST_CW_CLNT_HELLO_B:			s->shutdown=0;			ret=ssl23_client_hello(s);			if (ret <= 0) goto end;			s->state=SSL23_ST_CR_SRVR_HELLO_A;			s->init_num=0;			break;		case SSL23_ST_CR_SRVR_HELLO_A:		case SSL23_ST_CR_SRVR_HELLO_B:			ret=ssl23_get_server_hello(s);			if (ret >= 0) cb=NULL;			goto end;			/* break; */		default:			SSLerr(SSL_F_SSL23_CONNECT,SSL_R_UNKNOWN_STATE);			ret= -1;			goto end;			/* break; */			}		if (s->debug) BIO_flush(s->wbio);		if ((cb != NULL) && (s->state != state))			{			new_state=s->state;			s->state=state;			cb(s,SSL_CB_CONNECT_LOOP,1);			s->state=new_state;			}		}end:	s->in_handshake--;	if (cb != NULL)		cb(s,SSL_CB_CONNECT_EXIT,ret);	return(ret);	}