destPort, proxyName, hostName); #endif
destPort,   ipBuffer, proxyName);
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;    infoObject->GetProxyName(&proxyName);    infoObject->GetHostName(&hostName);        if (!proxyName)    {        // Direct connection        status = CMT_OpenSSLConnection(control,                                       cmsock,                                       SSM_REQUEST_SSL_DATA_SSL,                                       PR_ntohs(addr->inet.port),                                       ipBuffer,                                       (hostName ? hostName : ipBuffer),                                       CM_FALSE,                                        nsnull);        }    else    {        // not supported yet.        return PR_FAILURE;#if 0        PRInt32 destPort;                infoObject->GetProxyPort(&destPort);        status = CMT_OpenSSLProxyConnection(control,                                            cmsock,                                            destPort,                                             proxyName,  // wants IP                                            hostName);#endif    }    if (hostName)  Recycle(hostName);    if (proxyName) Recycle(proxyName);            if (CMTSuccess == status)    {        // 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;}