BIO *under;
int ssl3_write(s,buf,len)SSL *s;const char *buf;int len;	{	int ret,n;	BIO *under;#if 0	if (s->shutdown & SSL_SEND_SHUTDOWN)		{		s->rwstate=SSL_NOTHING;		return(0);		}#endif	clear_sys_error();	if (s->s3->renegotiate) ssl3_renegotiate_check(s);	/* This is an experimental flag that sends the	 * last handshake message in the same packet as the first	 * use data - used to see if it helps the TCP protocol during	 * session-id reuse */	/* The second test is because the buffer may have been removed */	if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio))		{		/* First time through, we write into the buffer */		if (s->s3->delay_buf_pop_ret == 0)			{			ret=ssl3_write_bytes(s,SSL3_RT_APPLICATION_DATA,				(char *)buf,len);			if (ret <= 0) return(ret);			s->s3->delay_buf_pop_ret=ret;			}		s->rwstate=SSL_WRITING;		n=BIO_flush(s->wbio);		if (n <= 0) return(n);		s->rwstate=SSL_NOTHING;		/* We have flushed the buffer */		under=BIO_pop(s->wbio);		s->wbio=under;		BIO_free(s->bbio);		s->bbio=NULL;		ret=s->s3->delay_buf_pop_ret;		s->s3->delay_buf_pop_ret=0;		s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER;		}	else		{		ret=ssl3_write_bytes(s,SSL3_RT_APPLICATION_DATA,			(char *)buf,len);		if (ret <= 0) return(ret);		}	return(ret);	}