ss->writerThread = NULL;
ssl_SecureSend(sslSocket *ss, const unsigned char *buf, int len, int flags){    sslSecurityInfo *sec;    int              rv		= 0;    PORT_Assert(ss->sec != 0);    sec = ss->sec;    if (ss->shutdownHow & ssl_SHUTDOWN_SEND) {	PORT_SetError(PR_SOCKET_SHUTDOWN_ERROR);    	return PR_FAILURE;    }    if (flags) {	PORT_SetError(PR_INVALID_ARGUMENT_ERROR);    	return PR_FAILURE;    }    ssl_GetXmitBufLock(ss);    if (ss->pendingBuf.len != 0) {	PORT_Assert(ss->pendingBuf.len > 0);	rv = ssl_SendSavedWriteData(ss, &ss->pendingBuf, ssl_DefSend);	if (ss->pendingBuf.len != 0) {	    PORT_Assert(ss->pendingBuf.len > 0);	    PORT_SetError(PR_WOULD_BLOCK_ERROR);	    rv = SECFailure;	}    }    ssl_ReleaseXmitBufLock(ss);    if (rv < 0) {	return rv;    }    /* If any of these is non-zero, the initial handshake is not done. */    if (!ss->connected) {	ssl_Get1stHandshakeLock(ss);	if (ss->handshake || ss->nextHandshake || ss->securityHandshake) {	    rv = ssl_Do1stHandshake(ss);	}	ssl_Release1stHandshakeLock(ss);    }    if (rv < 0) {	return rv;    }    /* Check for zero length writes after we do housekeeping so we make forward     * progress.     */    if (len == 0) return 0;    PORT_Assert(buf != NULL);        SSL_TRC(2, ("%d: SSL[%d]: SecureSend: sending %d bytes",		SSL_GETPID(), ss->fd, len));    /* Send out the data using one of these functions:     *	ssl2_SendClear, ssl2_SendStream, ssl2_SendBlock,      *  ssl3_SendApplicationData     */    ssl_GetXmitBufLock(ss);    rv = (*sec->send)(ss, buf, len, flags);    ssl_ReleaseXmitBufLock(ss);    return rv;}