nsPSMTracker::increaseSSLSocketCounter();
nsSSLIOLayerAddToSocket(const char* host,                        PRInt32 port,                        const char* proxyHost,                        PRInt32 proxyPort,                        PRFileDesc* fd,                        nsISupports** info,                        PRBool forSTARTTLS){  PRFileDesc* layer = nsnull;  nsresult rv;  // XXX - this code is duplicated in nsSSLIONewSocket  if (firstTime) {    InitNSSMethods();    gTLSIntolerantSites =  new nsCStringHashSet();    if (!gTLSIntolerantSites)      return NS_ERROR_OUT_OF_MEMORY;    gTLSIntolerantSites->Init(1);    firstTime = PR_FALSE;  }  nsNSSSocketInfo* infoObject = new nsNSSSocketInfo();  if (!infoObject) return NS_ERROR_FAILURE;    NS_ADDREF(infoObject);  infoObject->SetForSTARTTLS(forSTARTTLS);  infoObject->SetHostName(host);  infoObject->SetPort(port);  PRFileDesc *sslSock = nsSSLIOLayerImportFD(fd, infoObject, host);  if (!sslSock) {    NS_ASSERTION(PR_FALSE, "NSS: Error importing socket");    goto loser;  }  infoObject->SetFileDescPtr(sslSock);  rv = nsSSLIOLayerSetOptions(sslSock, forSTARTTLS, proxyHost, host, port,                              infoObject);  if (NS_FAILED(rv))    goto loser;  /* Now, layer ourselves on top of the SSL socket... */  layer = PR_CreateIOLayerStub(nsSSLIOLayerIdentity,                               &nsSSLIOLayerMethods);  if (!layer)    goto loser;    layer->secret = (PRFilePrivate*) infoObject;  rv = PR_PushIOLayer(sslSock, PR_GetLayersIdentity(sslSock), layer);    if (NS_FAILED(rv)) {    goto loser;  }  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Socket set up\n", (void*)sslSock));  infoObject->QueryInterface(NS_GET_IID(nsISupports), (void**) (info));  // We are going use a clear connection first //  if (forSTARTTLS || proxyHost) {    infoObject->SetHandshakePending(PR_FALSE);  }  return NS_OK; loser:  NS_IF_RELEASE(infoObject);  if (layer) {    layer->dtor(layer);  }  return NS_ERROR_FAILURE;}