harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r997657 - in /harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse: SSLEngineImpl.java SSLSessionImpl.java
Date Thu, 16 Sep 2010 09:48:48 GMT
Author: odeakin
Date: Thu Sep 16 09:48:48 2010
New Revision: 997657

URL: http://svn.apache.org/viewvc?rev=997657&view=rev
Log:
Modify SSLSessionImpl to allow its data to be refreshed when SSLEngine has completed its handshake.

Modified:
    harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java
    harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java

Modified: harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java?rev=997657&r1=997656&r2=997657&view=diff
==============================================================================
--- harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java
(original)
+++ harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java
Thu Sep 16 09:48:48 2010
@@ -468,6 +468,12 @@ public class SSLEngineImpl extends SSLEn
         
         // update handshake status
         handshakeStatus = result.getHandshakeStatus();
+
+        if (handshakeStatus == SSLEngineResult.HandshakeStatus.FINISHED) {
+            // If we've just completed the handshake, refresh the data in the SSLSession
+            session.refreshSessionData(null, sslParameters, SSL);
+        }
+
         return result;
     }
 
@@ -544,6 +550,12 @@ public class SSLEngineImpl extends SSLEn
         
         // update handshake status
         handshakeStatus = result.getHandshakeStatus();
+
+        if (handshakeStatus == SSLEngineResult.HandshakeStatus.FINISHED) {
+            // If we've just completed the handshake, refresh the data in the SSLSession
+            session.refreshSessionData(null, sslParameters, SSL);
+        }
+
         return result;
     }
     

Modified: harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java?rev=997657&r1=997656&r2=997657&view=diff
==============================================================================
--- harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
(original)
+++ harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
Thu Sep 16 09:48:48 2010
@@ -197,14 +197,16 @@ public class SSLSessionImpl implements S
     }
 
     public SSLSessionImpl(SSLParameters parms, long SSL) {
-        sslParameters = parms;
-        this.SSL = SSL;
+        refreshSessionData(null, parms, SSL);
+    }
 
-        // Initialise defaults for peer.
-        // These will be set later if an SSLSocket is construting this session
-        peerPort = -1;
-        peerHost = null;
+    public SSLSessionImpl(SSLSocket socket, SSLParameters parms, long SSL) {
+        refreshSessionData(socket, parms, SSL);
+    }
 
+    public void refreshSessionData(SSLSocket socket, SSLParameters parms, long SSL) {
+        sslParameters = parms;
+        this.SSL = SSL;
         this.isServer = !sslParameters.getUseClientMode();
 
         if (SSL == 0) {
@@ -222,6 +224,11 @@ public class SSLSessionImpl implements S
 
             creationTime = getCreationTimeImpl(SSL_SESSION);
 
+            if (socket != null) {
+                peerPort = socket.getPort();
+                peerHost = socket.getInetAddress().getHostName();
+            }
+
             id = new byte[32];
             rng.nextBytes(id);
             long time = creationTime / 1000;
@@ -255,14 +262,6 @@ public class SSLSessionImpl implements S
         localCertificates = parms.getCertificateChain();
     }
 
-    public SSLSessionImpl(SSLSocket socket, SSLParameters parms, long SSL) {
-        this(parms, SSL);
-        if (socket != null) {
-            peerPort = socket.getPort();
-            peerHost = socket.getInetAddress().getHostName();
-        }
-    }
-
     public int getApplicationBufferSize() {
         return MAX_DATA_LENGTH;
     }



Mime
View raw message