diff options
Diffstat (limited to 'jrt')
-rw-r--r-- | jrt/src/com/yahoo/jrt/MaybeTlsCryptoSocket.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/jrt/src/com/yahoo/jrt/MaybeTlsCryptoSocket.java b/jrt/src/com/yahoo/jrt/MaybeTlsCryptoSocket.java index 1cf3dfd1261..7c09b8b47ca 100644 --- a/jrt/src/com/yahoo/jrt/MaybeTlsCryptoSocket.java +++ b/jrt/src/com/yahoo/jrt/MaybeTlsCryptoSocket.java @@ -67,7 +67,9 @@ public class MaybeTlsCryptoSocket implements CryptoSocket { @Override public HandshakeResult handshake() throws IOException { if (factory != null) { - channel().read(buffer.getWritable(SNOOP_SIZE)); + if (channel().read(buffer.getWritable(SNOOP_SIZE)) == -1) { + throw new IOException("jrt: Connection closed by peer during tls detection"); + } if (buffer.bytes() < SNOOP_SIZE) { return HandshakeResult.NEED_READ; } |