HostAndPort key = new HostAndPort(host, port); NativeSslSession session = null; synchronized (sessionsByHostAndPort) {
HostAndPort key = new HostAndPort(host, port); NativeSslSession session = null; synchronized (sessionsByHostAndPort) {
@Override void onBeforeAddSession(NativeSslSession session) { String host = session.getPeerHost(); int port = session.getPeerPort(); if (host == null) { return; } HostAndPort key = new HostAndPort(host, port); putSession(key, session); // TODO: Do this in a background thread. if (persistentCache != null && !session.isSingleUse()) { byte[] data = session.toBytes(); if (data != null) { persistentCache.putSessionData(session.toSSLSession(), data); } } }
@Override void onBeforeAddSession(NativeSslSession session) { String host = session.getPeerHost(); int port = session.getPeerPort(); if (host == null) { return; } HostAndPort key = new HostAndPort(host, port); putSession(key, session); // TODO: Do this in a background thread. if (persistentCache != null && !session.isSingleUse()) { byte[] data = session.toBytes(); if (data != null) { persistentCache.putSessionData(session.toSSLSession(), data); } } }
@Override void onBeforeRemoveSession(NativeSslSession session) { String host = session.getPeerHost(); if (host == null) { return; } int port = session.getPeerPort(); HostAndPort hostAndPortKey = new HostAndPort(host, port); removeSession(hostAndPortKey, session); }
@Override void onBeforeRemoveSession(NativeSslSession session) { String host = session.getPeerHost(); if (host == null) { return; } int port = session.getPeerPort(); HostAndPort hostAndPortKey = new HostAndPort(host, port); removeSession(hostAndPortKey, session); }