kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject kafka git commit: KAFKA-2801; Process any remaining data in SSL network read buffer after handshake
Date Wed, 11 Nov 2015 00:37:22 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 04827e6e9 -> ea702c384


KAFKA-2801; Process any remaining data in SSL network read buffer after handshake

Process any remaining data in the network read buffer in `SslTransportLayer` when `read()`
is invoked. On handshake completion, there could be application data ready to be processed
that was read into `netReadBuffer` during handshake processing. `read()` is already invoked
from `Selector` after handshake completion, but data already read into the `netReadBuffer`
was not being processed. This PR adds a check for remaining data and continues with processing
data if data is available.

Author: Rajini Sivaram <rajinisivaram@googlemail.com>

Reviewers: Jun Rao <junrao@gmail.com>

Closes #493 from rajinisivaram/KAFKA-2801


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/ea702c38
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/ea702c38
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/ea702c38

Branch: refs/heads/trunk
Commit: ea702c384fcfb5a46c5d1354498e418c5801ed30
Parents: 04827e6
Author: Rajini Sivaram <rajinisivaram@googlemail.com>
Authored: Tue Nov 10 16:37:16 2015 -0800
Committer: Jun Rao <junrao@gmail.com>
Committed: Tue Nov 10 16:37:16 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/kafka/common/network/SslTransportLayer.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/ea702c38/clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java
b/clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java
index ffd2a9e..c7873ad 100644
--- a/clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java
+++ b/clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java
@@ -440,7 +440,7 @@ public class SslTransportLayer implements TransportLayer {
             netReadBuffer = Utils.ensureCapacity(netReadBuffer, netReadBufferSize());
             if (netReadBuffer.remaining() > 0) {
                 int netread = socketChannel.read(netReadBuffer);
-                if (netread == 0) return netread;
+                if (netread == 0 && netReadBuffer.position() == 0) return netread;
                 else if (netread < 0) throw new EOFException("EOF during read");
             }
             do {


Mime
View raw message