sid->lastAccessTime = now;
ssl_LookupSID(const PRIPv6Addr *addr, PRUint16 port, const char *peerID,               const char * urlSvrName){    sslSessionID **sidp;    sslSessionID * sid;    PRUint32       now;    if (!urlSvrName)    	return NULL;    now = ssl_Time();    LOCK_CACHE;    sidp = &cache;    while ((sid = *sidp) != 0) {	PORT_Assert(sid->cached == in_client_cache);	PORT_Assert(sid->references >= 1);	SSL_TRC(8, ("SSL: Lookup1: sid=0x%x", sid));	if (sid->time < now || !sid->references) {	    /*	    ** This session-id timed out, or was orphaned.	    ** Don't even care who it belongs to, blow it out of our cache.	    */	    SSL_TRC(7, ("SSL: lookup1, throwing sid out, age=%d refs=%d",			now - sid->time, sid->references));	    *sidp = sid->next; 			/* delink it from the list. */	    sid->cached = invalid_cache;	/* mark not on list. */	    if (!sid->references)	    	ssl_DestroySID(sid);	    else		ssl_FreeLockedSID(sid);		/* drop ref count, free. */	} else if (!memcmp(&sid->addr, addr, sizeof(PRIPv6Addr)) && /* server IP addr matches */	           (sid->port == port) && /* server port matches */		   /* proxy (peerID) matches */		   (((peerID == NULL) && (sid->peerID == NULL)) ||		    ((peerID != NULL) && (sid->peerID != NULL) &&		     PORT_Strcmp(sid->peerID, peerID) == 0)) &&		   /* is cacheable */		   (sid->version < SSL_LIBRARY_VERSION_3_0 ||		    sid->u.ssl3.resumable) &&		   /* server hostname matches. */	           (sid->urlSvrName != NULL) &&		   ((0 == PORT_Strcmp(urlSvrName, sid->urlSvrName)) ||		    ((sid->peerCert != NULL) && (SECSuccess == 		      CERT_VerifyCertName(sid->peerCert, urlSvrName))) )		  ) {	    /* Hit */	    sid->references++;	    break;	} else {	    sidp = &sid->next;	}    }    UNLOCK_CACHE;    return sid;}