diff options
author | Bjørn Christian Seime <bjorn.christian@seime.no> | 2018-11-05 16:56:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-05 16:56:27 +0100 |
commit | f544fe2803fe73be951177db8b0e595d26f52277 (patch) | |
tree | 61b2a0638f8a9427308436c275df2a992cbb245b | |
parent | c865c789f5368971941a3b3b2f42b09ef99ef6aa (diff) | |
parent | c91312a1a2e005224af729f951cb2c71b98c9ac0 (diff) |
Merge pull request #7574 from vespa-engine/bjorncs/debug-logging
Bjorncs/debug logging
-rw-r--r-- | jrt/src/com/yahoo/jrt/TlsCryptoSocket.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/jrt/src/com/yahoo/jrt/TlsCryptoSocket.java b/jrt/src/com/yahoo/jrt/TlsCryptoSocket.java index 96aca622af4..39cd9f6c4f2 100644 --- a/jrt/src/com/yahoo/jrt/TlsCryptoSocket.java +++ b/jrt/src/com/yahoo/jrt/TlsCryptoSocket.java @@ -44,6 +44,7 @@ public class TlsCryptoSocket implements CryptoSocket { // Note: Dummy buffer as unwrap requires a full size application buffer even though no application data is unwrapped this.handshakeDummyBuffer = ByteBuffer.allocate(nullSession.getApplicationBufferSize()); this.handshakeState = HandshakeState.NOT_STARTED; + log.fine(() -> "Initialized with " + sslEngine.toString()); } // inject pre-read data into the read pipeline (typically called by MaybeTlsCryptoSocket) @@ -67,6 +68,7 @@ public class TlsCryptoSocket implements CryptoSocket { private HandshakeState processHandshakeState(HandshakeState state) throws IOException { switch (state) { case NOT_STARTED: + log.fine(() -> "Initiating handshake"); sslEngine.beginHandshake(); break; case NEED_WRITE: @@ -82,6 +84,7 @@ public class TlsCryptoSocket implements CryptoSocket { } while (true) { + log.fine(() -> "SSLEngine.getHandshakeStatus(): " + sslEngine.getHandshakeStatus()); switch (sslEngine.getHandshakeStatus()) { case NOT_HANDSHAKING: if (wrapBuffer.bytes() > 0) return HandshakeState.NEED_WRITE; @@ -90,6 +93,7 @@ public class TlsCryptoSocket implements CryptoSocket { SSLSession session = sslEngine.getSession(); sessionApplicationBufferSize = session.getApplicationBufferSize(); sessionPacketBufferSize = session.getPacketBufferSize(); + log.fine(() -> String.format("Handshake complete: protocol=%s, cipherSuite=%s", session.getProtocol(), session.getCipherSuite())); return HandshakeState.COMPLETED; case NEED_TASK: sslEngine.getDelegatedTask().run(); @@ -150,6 +154,7 @@ public class TlsCryptoSocket implements CryptoSocket { @Override public int write(ByteBuffer src) throws IOException { + verifyHandshakeCompleted(); if (flush() == FlushResult.NEED_WRITE) return 0; int totalBytesWrapped = 0; int bytesWrapped; @@ -162,6 +167,7 @@ public class TlsCryptoSocket implements CryptoSocket { @Override public FlushResult flush() throws IOException { + verifyHandshakeCompleted(); channelWrite(); return wrapBuffer.bytes() > 0 ? FlushResult.NEED_WRITE : FlushResult.DONE; } |