if (ss->useSecurity &&
if (ss->opt.useSecurity &&
ssl_Poll(PRFileDesc *fd, PRInt16 how_flags, PRInt16 *p_out_flags){    sslSocket *ss;    PRInt16    new_flags = how_flags;	/* should select on these flags. */    PRNetAddr  addr;    *p_out_flags = 0;    ss = ssl_GetPrivate(fd);    if (!ss) {	SSL_DBG(("%d: SSL[%d]: bad socket in SSL_Poll",		 SSL_GETPID(), fd));	return 0;	/* don't poll on this socket */    }    if (ss->useSecurity && 	ss->handshaking != sslHandshakingUndetermined &&        !ss->firstHsDone &&	(how_flags & PR_POLL_RW)) {	if (!ss->TCPconnected) {	    ss->TCPconnected = (PR_SUCCESS == ssl_DefGetpeername(ss, &addr));	}	/* If it's not connected, then presumably the application is polling	** on read or write appropriately, so don't change it. 	*/	if (ss->TCPconnected) {	    if (!ss->handshakeBegun) {		/* If the handshake has not begun, poll on read or write 		** based on the local application's role in the handshake,		** not based on what the application requested.		*/		new_flags &= ~PR_POLL_RW;		if (ss->handshaking == sslHandshakingAsClient) {		    new_flags |= PR_POLL_WRITE;		} else { /* handshaking as server */		    new_flags |= PR_POLL_READ;		}	    } else 	    /* First handshake is in progress */	    if (ss->lastWriteBlocked) {		if (new_flags & PR_POLL_READ) {		    /* The caller is waiting for data to be received, 		    ** but the initial handshake is blocked on write, or the 		    ** client's first handshake record has not been written.		    ** The code should select on write, not read.		    */		    new_flags ^=  PR_POLL_READ;	   /* don't select on read. */		    new_flags |=  PR_POLL_WRITE;   /* do    select on write. */		}	    } else if (new_flags & PR_POLL_WRITE) {		    /* The caller is trying to write, but the handshake is 		    ** blocked waiting for data to read, and the first 		    ** handshake has been sent.  so do NOT to poll on write.		    */		    new_flags ^=  PR_POLL_WRITE;   /* don't select on write. */		    new_flags |=  PR_POLL_READ;	   /* do    select on read. */	    }	}    } else if ((new_flags & PR_POLL_READ) && (SSL_DataPending(fd) > 0)) {	*p_out_flags = PR_POLL_READ;	/* it's ready already. */	return new_flags;    } else if ((ss->lastWriteBlocked) && (how_flags & PR_POLL_READ) &&	       (ss->pendingBuf.len != 0)) { /* write data waiting to be sent */	new_flags |=  PR_POLL_WRITE;   /* also select on write. */    }     if (new_flags && (fd->lower->methods->poll != NULL)) {	PRInt16    lower_out_flags = 0;	PRInt16    lower_new_flags;        lower_new_flags = fd->lower->methods->poll(fd->lower, new_flags, 					           &lower_out_flags);	if ((lower_new_flags & lower_out_flags) && (how_flags != new_flags)) {	    PRInt16 out_flags = lower_out_flags & ~PR_POLL_RW;	    if (lower_out_flags & PR_POLL_READ) 		out_flags |= PR_POLL_WRITE;	    if (lower_out_flags & PR_POLL_WRITE) 		out_flags |= PR_POLL_READ;	    *p_out_flags = out_flags;	    new_flags = how_flags;	} else {	    *p_out_flags = lower_out_flags;	    new_flags    = lower_new_flags;	}    }    return new_flags;}