PORT_Assert( ssl_Have1stHandshakeLock(ss) );
PORT_Assert( ss->opt.noLocks || ssl_Have1stHandshakeLock(ss) );
ssl_GatherRecord1stHandshake(sslSocket *ss){    int rv;    PORT_Assert( ssl_Have1stHandshakeLock(ss) );    ssl_GetRecvBufLock(ss);    if (ss->version >= SSL_LIBRARY_VERSION_3_0) {	/* Wait for handshake to complete, or application data to arrive.  */	rv = ssl3_GatherCompleteHandshake(ss, 0);    } else {	/* See if we have a complete record */	rv = ssl2_GatherRecord(ss, 0);    }    SSL_TRC(10, ("%d: SSL[%d]: handshake gathering, rv=%d",		 SSL_GETPID(), ss->fd, rv));    ssl_ReleaseRecvBufLock(ss);    if (rv <= 0) {	if (rv == SECWouldBlock) {	    /* Progress is blocked waiting for callback completion.  */	    SSL_TRC(10, ("%d: SSL[%d]: handshake blocked (need %d)",			 SSL_GETPID(), ss->fd, ss->gs.remainder));	    return SECWouldBlock;	}	if (rv == 0) {	    /* EOF. Loser  */	    PORT_SetError(PR_END_OF_FILE_ERROR);	}	return SECFailure;	/* rv is < 0 here. */    }    SSL_TRC(10, ("%d: SSL[%d]: got handshake record of %d bytes",		 SSL_GETPID(), ss->fd, ss->gs.recordLen));    ss->handshake = 0;	/* makes ssl_Do1stHandshake call ss->nextHandshake.*/    return SECSuccess;}