KAFKA-7012: Don't process SSL channels without data to process (#5237)
Avoid unnecessary processing of SSL channels when there are some bytes buffered, but not enough to make progress.
Reviewers: Radai Rosenblatt <radai.rosenblatt@gmail.com>, Jun Rao <junrao@gmail.com>
@ -64,6 +64,7 @@ public class SslTransportLayer implements TransportLayer {
@@ -64,6 +64,7 @@ public class SslTransportLayer implements TransportLayer {
@ -503,13 +504,17 @@ public class SslTransportLayer implements TransportLayer {
@@ -503,13 +504,17 @@ public class SslTransportLayer implements TransportLayer {
@ -563,6 +568,7 @@ public class SslTransportLayer implements TransportLayer {
@@ -563,6 +568,7 @@ public class SslTransportLayer implements TransportLayer {
if(netread<=0||isClosed)
break;
}
updateBytesBuffered(readFromNetwork||read>0);
// If data has been read and unwrapped, return the data even if end-of-stream, channel will be closed
// on a subsequent poll.
returnread;
@ -793,6 +799,11 @@ public class SslTransportLayer implements TransportLayer {
@@ -793,6 +799,11 @@ public class SslTransportLayer implements TransportLayer {
@ -826,12 +837,22 @@ public class SslTransportLayer implements TransportLayer {
@@ -826,12 +837,22 @@ public class SslTransportLayer implements TransportLayer {