if (layer)
if (! layer)
nsSSLIOLayerNewSocket(const char* hostName, PRFileDesc **fd, nsISupports **securityInfo){    static PRBool  firstTime = PR_TRUE;    *fd = nsnull;    *securityInfo = nsnull;    PRFileDesc *   layer;    PRFileDesc *   sock;    PRStatus       rv;    /* Get a normal NSPR socket */    sock = PR_NewTCPSocket();  PR_ASSERT(NULL != sock);    if (! sock) return NS_ERROR_FAILURE;    if (firstTime)    {        nsSSLIOLayerIdentity        = PR_GetUniqueIdentity("Cartman layer");        nsSSLIOLayerMethods         = *PR_GetDefaultIOMethods();        nsSSLIOLayerMethods.connect = nsSSLIOLayerConnect;        nsSSLIOLayerMethods.close   = nsSSLIOLayerClose;        nsSSLIOLayerMethods.read    = nsSSLIOLayerRead;        nsSSLIOLayerMethods.write   = nsSSLIOLayerWrite;        firstTime                   = PR_FALSE;    }      layer = PR_CreateIOLayerStub(nsSSLIOLayerIdentity, &nsSSLIOLayerMethods);    if (layer)    {        layer->secret = (PRFilePrivate*)hostName;        rv = PR_PushIOLayer(sock, PR_GetLayersIdentity(sock), layer);    }    if(PR_SUCCESS != rv)        return NS_ERROR_FAILURE;    *fd = sock;    return NS_OK;}