(CMBool)forceHandshake,
handshake,
nsSSLIOLayerConnect(PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout){    nsresult                result;    PRStatus                rv = PR_SUCCESS;    CMTStatus               status = CMTFailure;        /* Set the error in case of failure. */        PR_SetError(PR_UNKNOWN_ERROR, status);        if (!fd || !addr || !fd->secret || !gPSMService)        return PR_FAILURE;        char ipBuffer[PR_NETDB_BUF_SIZE];    rv = PR_NetAddrToString(addr, (char*)&ipBuffer, PR_NETDB_BUF_SIZE);    if (rv != PR_SUCCESS)        return PR_FAILURE;        if (addr->raw.family == PR_AF_INET6 && PR_IsNetAddrType(addr, PR_IpAddrV4Mapped))     {        /* Chop off the leading "::ffff:" */        strcpy(ipBuffer, ipBuffer + 7);    }        CMT_CONTROL *control;    result = gPSMService->GetControlConnection(&control);    if (result != PR_SUCCESS)        return PR_FAILURE;        CMSocket* cmsock = (CMSocket *)PR_Malloc(sizeof(CMSocket));    if (!cmsock)        return PR_FAILURE;        memset(cmsock, 0, sizeof(CMSocket));        cmsock->fd        = fd->lower;    cmsock->isUnix    = PR_FALSE;        nsPSMSocketInfo *infoObject = (nsPSMSocketInfo *)fd->secret;        infoObject->SetControlPtr(control);    infoObject->SetSocketPtr(cmsock);        char* proxyName;    char* hostName;    PRInt32 proxyPort;    PRInt32 hostPort;    PRBool forceHandshake;    infoObject->GetProxyName(&proxyName);    infoObject->GetHostName(&hostName);    infoObject->GetProxyPort(&proxyPort);    infoObject->GetHostPort(&hostPort);    infoObject->GetForceHandshake(&forceHandshake);        if (!proxyName)    {        // Direct connection        status = CMT_OpenSSLConnection(control,                                       cmsock,                                       SSM_REQUEST_SSL_DATA_SSL,                                       PR_ntohs(addr->inet.port),                                       ipBuffer,                                       (hostName ? hostName : ipBuffer),                                       (CMBool)forceHandshake,                                       nsnull);    }    else    {        PRInt32 destPort;                infoObject->GetProxyPort(&destPort);                status = CMT_OpenSSLProxyConnection(control,                                            cmsock,                                            destPort,                                            // we assume that we were called                                             // with the addr of the proxy host                                            ipBuffer,                                            proxyName);    }        if (hostName)  Recycle(hostName);    if (proxyName) Recycle(proxyName);        if (CMTSuccess == status)    {        PRSocketOptionData sockopt;        sockopt.option = PR_SockOpt_Nonblocking;        rv = PR_GetSocketOption(fd, &sockopt);                if (PR_SUCCESS == rv && !sockopt.value.non_blocking) {            // this is a nonblocking socket, so we can return success            return PR_SUCCESS;        }                // since our stuff can block, what we want to do is return PR_FAILURE,        // but set the nspr ERROR to BLOCK.  This will put us into a select        // q.        PR_SetError(PR_WOULD_BLOCK_ERROR, status);        return PR_FAILURE;    }        return PR_FAILURE;}