src/java.base/share/classes/sun/security/ssl/Alert.java
changeset 51407 910f7b56592f
parent 51222 d5138f8da1ba
child 53056 9041178a0b69
equal deleted inserted replaced
51406:f4b4dfac45b1 51407:910f7b56592f
   233             }
   233             }
   234 
   234 
   235             Level level = Level.valueOf(am.level);
   235             Level level = Level.valueOf(am.level);
   236             Alert alert = Alert.valueOf(am.id);
   236             Alert alert = Alert.valueOf(am.id);
   237             if (alert == Alert.CLOSE_NOTIFY) {
   237             if (alert == Alert.CLOSE_NOTIFY) {
   238                 if (tc.handshakeContext != null) {
   238                 tc.isInputCloseNotified = true;
       
   239                 tc.closeInbound();
       
   240 
       
   241                 if (tc.peerUserCanceled) {
       
   242                     tc.closeOutbound();
       
   243                 } else if (tc.handshakeContext != null) {
   239                     tc.fatal(Alert.UNEXPECTED_MESSAGE,
   244                     tc.fatal(Alert.UNEXPECTED_MESSAGE,
   240                             "Received close_notify during handshake");
   245                             "Received close_notify during handshake");
   241                 }
   246                 }
   242 
   247             } else if (alert == Alert.USER_CANCELED) {
   243                 tc.isInputCloseNotified = true;
   248                 if (level == Level.WARNING) {
   244                 tc.closeInbound();
   249                     tc.peerUserCanceled = true;
       
   250                 } else {
       
   251                     tc.fatal(alert,
       
   252                             "Received fatal close_notify alert", true, null);
       
   253                 }
   245             } else if ((level == Level.WARNING) && (alert != null)) {
   254             } else if ((level == Level.WARNING) && (alert != null)) {
   246                 // Terminate the connection if an alert with a level of warning
   255                 // Terminate the connection if an alert with a level of warning
   247                 // is received during handshaking, except the no_certificate
   256                 // is received during handshaking, except the no_certificate
   248                 // warning.
   257                 // warning.
   249                 if (alert.handshakeOnly && (tc.handshakeContext != null)) {
   258                 if (alert.handshakeOnly && (tc.handshakeContext != null)) {