JSSE: delay creation of WolfSSLImplementSSLSession objects until needed, reduces overall memory usage by active objects
parent
544e054ce3
commit
90a1f0308c
|
@ -348,11 +348,6 @@ public class WolfSSLAuthStore {
|
|||
* after the resumed session completes the handshake, for
|
||||
* subsequent resumption attempts to use. */
|
||||
store.remove(toHash.hashCode());
|
||||
|
||||
/* Make copy/clone of session object so multiple threads
|
||||
* don't try to use the same cache entry. Cache entry will
|
||||
* be overwritten when new session with same key is stored */
|
||||
ses = new WolfSSLImplementSSLSession(ses);
|
||||
ses.isFromTable = true;
|
||||
|
||||
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
|
||||
|
|
|
@ -80,7 +80,6 @@ public class WolfSSLEngineHelper {
|
|||
this.ssl = ssl;
|
||||
this.params = params;
|
||||
this.authStore = store;
|
||||
this.session = new WolfSSLImplementSSLSession(store);
|
||||
|
||||
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
|
||||
"created new WolfSSLEngineHelper()");
|
||||
|
@ -107,7 +106,6 @@ public class WolfSSLEngineHelper {
|
|||
this.port = port;
|
||||
this.hostname = hostname;
|
||||
this.authStore = store;
|
||||
this.session = new WolfSSLImplementSSLSession(store);
|
||||
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
|
||||
"created new WolfSSLEngineHelper(port: " + port +
|
||||
", hostname: " + hostname + ")");
|
||||
|
@ -140,7 +138,10 @@ public class WolfSSLEngineHelper {
|
|||
* @return WolfSSLImplementSession for this object
|
||||
*/
|
||||
protected WolfSSLImplementSSLSession getSession() {
|
||||
return session;
|
||||
if (this.session == null) {
|
||||
this.session = new WolfSSLImplementSSLSession(authStore);
|
||||
}
|
||||
return this.session;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -823,7 +824,7 @@ public class WolfSSLEngineHelper {
|
|||
return WolfSSL.SSL_HANDSHAKE_FAILURE;
|
||||
}
|
||||
|
||||
if (!this.session.isValid()) {
|
||||
if ((this.session == null) || !this.session.isValid()) {
|
||||
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
|
||||
"session is marked as invalid, try creating a new seesion");
|
||||
if (this.sessionCreation == false) {
|
||||
|
|
Loading…
Reference in New Issue