src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java
branchJDK-8145252-TLS13-branch
changeset 56558 4a3deb6759b1
parent 56542 56aaa6cb3693
child 56561 5f23e0400f27
--- a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java	Tue May 15 10:48:19 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java	Tue May 15 14:54:04 2018 -0400
@@ -216,10 +216,13 @@
                         "Produced NewSessionTicket handshake message", nstm);
             }
 
-            // cache the new session
+            // create and cache the new session
+            // The new session must be a child of the existing session so
+            // they will be invalidated together, etc.
             SSLSessionImpl sessionCopy = new SSLSessionImpl(shc,
                 shc.handshakeSession.getSuite(), newId,
                 shc.handshakeSession.getCreationTime());
+            shc.handshakeSession.addChild(sessionCopy);
             sessionCopy.setPreSharedKey(psk);
             sessionCopy.setPskIdentity(newId.getId());
             sessionCopy.setTicketAgeAdd(nstm.ticketAgeAdd);
@@ -316,13 +319,16 @@
                 sessionToSave.getSuite().hashAlg, resumptionMasterSecret.get(),
                 nstm.ticketNonce);
 
-            // create the new session from the context
+            // create and cache the new session
+            // The new session must be a child of the existing session so
+            // they will be invalidated together, etc.
             chc.negotiatedProtocol = chc.conContext.protocolVersion;
             SessionId newId =
                 new SessionId(true, chc.sslContext.getSecureRandom());
             SSLSessionImpl sessionCopy =
                 new SSLSessionImpl(chc, sessionToSave.getSuite(), newId,
                 sessionToSave.getCreationTime());
+            sessionToSave.addChild(sessionCopy);
             sessionCopy.setPreSharedKey(psk);
             sessionCopy.setTicketAgeAdd(nstm.ticketAgeAdd);
             sessionCopy.setPskIdentity(nstm.ticket);