diff --git a/handler/src/main/java/io/netty/handler/ssl/OpenSslClientContext.java b/handler/src/main/java/io/netty/handler/ssl/OpenSslClientContext.java index 5574a6ee90..cf0952fba9 100644 --- a/handler/src/main/java/io/netty/handler/ssl/OpenSslClientContext.java +++ b/handler/src/main/java/io/netty/handler/ssl/OpenSslClientContext.java @@ -214,5 +214,15 @@ public final class OpenSslClientContext extends OpenSslContext { public int getSessionCacheSize() { return 0; } + + @Override + public void setSessionCacheEnabled(boolean enabled) { + // ignored + } + + @Override + public boolean isSessionCacheEnabled() { + return false; + } } } diff --git a/handler/src/main/java/io/netty/handler/ssl/OpenSslServerContext.java b/handler/src/main/java/io/netty/handler/ssl/OpenSslServerContext.java index 25e832722b..b55c93e36b 100644 --- a/handler/src/main/java/io/netty/handler/ssl/OpenSslServerContext.java +++ b/handler/src/main/java/io/netty/handler/ssl/OpenSslServerContext.java @@ -291,5 +291,16 @@ public final class OpenSslServerContext extends OpenSslContext { public int getSessionCacheSize() { return (int) SSLContext.getSessionCacheSize(context); } + + @Override + public void setSessionCacheEnabled(boolean enabled) { + long mode = enabled ? SSL.SSL_SESS_CACHE_SERVER : SSL.SSL_SESS_CACHE_OFF; + SSLContext.setSessionCacheMode(context, mode); + } + + @Override + public boolean isSessionCacheEnabled() { + return SSLContext.getSessionCacheMode(context) == SSL.SSL_SESS_CACHE_SERVER; + } } } diff --git a/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java b/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java index bde75884fd..fd1782114b 100644 --- a/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java +++ b/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java @@ -59,6 +59,16 @@ public abstract class OpenSslSessionContext implements SSLSessionContext { SSLContext.setSessionTicketKeys(context, keys); } + /** + * Enable or disable caching of SSL sessions. + */ + public abstract void setSessionCacheEnabled(boolean enabled); + + /** + * Return {@code true} if caching of SSL sessions is enabled, {@code false} otherwise. + */ + public abstract boolean isSessionCacheEnabled(); + /** * Returns the stats of this context. */