ss->peer = sa->inet.ip; ss->port = sa->inet.port;
if ((sa->inet.family & 0xff) == PR_AF_INET) { PR_ConvertIPv4AddrToIPv6(sa->inet.ip, &ss->peer); ss->port = sa->inet.port; } else { PORT_Assert(sa->ipv6.family == PR_AF_INET6); ss->peer = sa->ipv6.ip; ss->port = sa->ipv6.port; }
ssl_SocksConnect(sslSocket *ss, const PRNetAddr *sa){    int rv, err, direct;    PRNetAddr daemon;    const PRNetAddr *sip;    char *user;    PRFileDesc *osfd = ss->fd->lower;    /* Figure out where to connect to */    rv = FindDaemon(ss, &daemon);    if (rv) {	return SECFailure;    }    direct = ChooseAddress(ss, sa);    if (direct) {	sip = sa;	ss->socks->direct = 1;    } else {	sip = &daemon;	ss->socks->direct = 0;    }    SSL_TRC(10, ("%d: SSL[%d]: socks %s connect to %d.%d.%d.%d:%d",		 SSL_GETPID(), ss->fd,		 direct ? "direct" : "sockd",		 (PR_ntohl(sip->inet.ip) >> 24) & 0xff,		 (PR_ntohl(sip->inet.ip) >> 16) & 0xff,		 (PR_ntohl(sip->inet.ip) >> 8) & 0xff,		 PR_ntohl(sip->inet.ip) & 0xff,		 PR_ntohs(sip->inet.port)));    /* Attempt first connection */    rv = osfd->methods->connect(osfd, sip, ss->cTimeout);    err = PORT_GetError();#ifdef _WIN32    PR_Sleep(PR_INTERVAL_NO_WAIT);     /* workaround NT winsock connect bug. */#endif    if (rv < 0) {	if (err != PR_IS_CONNECTED_ERROR) {	    return rv;	}	/* Async connect finished */    }    /* If talking to sockd, do handshake */    if (!direct) {	/* Find user */#ifdef XP_UNIX#ifdef __386BSD__	user = bsdi_cuserid(NULL);#else	user = cuserid(NULL);#endif	if (!user) {	    PORT_SetError(PR_UNKNOWN_ERROR);	    SSL_DBG(("%d: SSL[%d]: cuserid fails, errno=%d",		     SSL_GETPID(), ss->fd, PORT_GetError()));	    return SECFailure;	}#else	user = "SSL";#endif	/* Send our message to it */	rv = SayHello(ss, SOCKS_CONNECT, sa, user);	if (rv) {	    return rv;	}	ss->handshake     = SocksStartGather;	ss->nextHandshake = 0;	/* save up who we're really talking to so we can index the cache */	ss->peer = sa->inet.ip;	ss->port = sa->inet.port;    }    return 0;}