harmony-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=997392&view=rev
Log:
Start to add session awareness to SSLEngineImpl.

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=997392&r1=997391&r2=997392&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
Wed Sep 15 16:40:15 2010
@@ -131,22 +131,27 @@ public class SSLEngineImpl extends SSLEn
         if (!handshake_started) {
             handshake_started = true;
 
+            SSLSessionContextImpl sessionContext;
             if (sslParameters.getUseClientMode()) {
                 if (logger != null) {
                     logger.println("SSLEngineImpl: CLIENT connecting");
                 }
 
                 handshakeStatus = connectImpl(SSL);
+                sessionContext = sslParameters.getClientSessionContext();
             } else {
                 if (logger != null) {
                     logger.println("SSLEngineImpl: SERVER accepting connection");
                 }
                 handshakeStatus = acceptImpl(SSL);
+                sessionContext = sslParameters.getServerSessionContext();
             }
+            session = new SSLSessionImpl(sslParameters, SSL);
+            sessionContext.putSession(session);
         }
     }
 
-    private static native void closeInboundImpl(long SSLEngineAddress);    
+    private static native void closeInboundImpl(long SSLEngineAddress);
 
     /**
      * Closes inbound operations of this engine

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=997392&r1=997391&r2=997392&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
Wed Sep 15 16:40:15 2010
@@ -192,13 +192,19 @@ public class SSLSessionImpl implements S
     private SSLSessionImpl() {
         creationTime = System.currentTimeMillis();
         cipherName = "SSL_NULL_WITH_NULL_NULL";
+        protocol = "NONE";
         id = new byte[0];
     }
 
-    public SSLSessionImpl(SSLSocket socket, SSLParameters parms, long SSL) {
+    public SSLSessionImpl(SSLParameters parms, long SSL) {
         sslParameters = parms;
         this.SSL = SSL;
 
+        // Initialise defaults for peer.
+        // These will be set later if an SSLSocket is construting this session
+        peerPort = -1;
+        peerHost = null;
+
         this.isServer = !sslParameters.getUseClientMode();
 
         if (SSL == 0) {
@@ -224,11 +230,6 @@ public class SSLSessionImpl implements S
             id[30] = (byte) ((time & 0x0000FF00) >>> 8);
             id[31] = (byte) ((time & 0x000000FF));
 
-            if (socket != null) {
-                peerPort = socket.getPort();
-                peerHost = socket.getInetAddress().getHostName();
-            }
-
             // Get the list of DER encoded peer certificates from OpenSSL
             Object[] DERCerts = getPeerCertificatesImpl(SSL);
             if (DERCerts != null) {
@@ -254,6 +255,14 @@ 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