You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2019/04/17 17:21:13 UTC
[geode] branch release/1.9.0 updated: GEODE-6664 CI failure:
org.apache.geode.ClusterCommunicationsDUnitTest.receiveBigResponse
This is an automated email from the ASF dual-hosted git repository.
bschuchardt pushed a commit to branch release/1.9.0
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/release/1.9.0 by this push:
new ed13a72 GEODE-6664 CI failure: org.apache.geode.ClusterCommunicationsDUnitTest.receiveBigResponse
ed13a72 is described below
commit ed13a72076f9be0e13bb6988e1f957a43d8c494e
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Wed Apr 17 10:12:48 2019 -0700
GEODE-6664 CI failure: org.apache.geode.ClusterCommunicationsDUnitTest.receiveBigResponse
Ensure that the encrypted buffer is at least as big as the
SSLSession's packet buffer size. That's required for proper decryption
of incoming packets.
(cherry picked from commit ff703dd4187638b2e5848c9e74f482f228d5a7cc)
---
.../java/org/apache/geode/internal/net/NioSslEngine.java | 15 +++++++--------
.../org/apache/geode/internal/net/NioSslEngineTest.java | 12 ++++++++++--
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
index f2e0e36..dd71d75 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
@@ -308,18 +308,17 @@ public class NioSslEngine implements NioFilter {
}
}
- /*
- * NioSslEngine doesn't need to ensure capacity in network buffers because they
- * are fixed in size by the SslContext. The size recommended by the context is
- * big enough for the SslEngine to do its work.
- */
@Override
public ByteBuffer ensureWrappedCapacity(int amount, ByteBuffer wrappedBuffer,
Buffers.BufferType bufferType, DMStats stats) {
- if (wrappedBuffer == null) {
- wrappedBuffer = Buffers.acquireBuffer(bufferType, amount, stats);
+ ByteBuffer buffer = wrappedBuffer;
+ int requiredSize = engine.getSession().getPacketBufferSize();
+ if (buffer == null) {
+ buffer = Buffers.acquireBuffer(bufferType, requiredSize, stats);
+ } else if (buffer.capacity() < requiredSize) {
+ buffer = Buffers.expandWriteBufferIfNeeded(bufferType, buffer, requiredSize, stats);
}
- return wrappedBuffer;
+ return buffer;
}
@Override
diff --git a/geode-core/src/test/java/org/apache/geode/internal/net/NioSslEngineTest.java b/geode-core/src/test/java/org/apache/geode/internal/net/NioSslEngineTest.java
index 68d7936..b12df09 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/net/NioSslEngineTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/net/NioSslEngineTest.java
@@ -373,14 +373,22 @@ public class NioSslEngineTest {
}
@Test
- public void ensureWrappedCapacity() {
- ByteBuffer buffer = ByteBuffer.allocate(10);
+ public void ensureWrappedCapacityOfSmallMessage() {
+ ByteBuffer buffer = ByteBuffer.allocate(netBufferSize);
assertThat(
nioSslEngine.ensureWrappedCapacity(10, buffer, Buffers.BufferType.UNTRACKED, mockStats))
.isEqualTo(buffer);
}
@Test
+ public void ensureWrappedCapacityWithNoBuffer() {
+ assertThat(
+ nioSslEngine.ensureWrappedCapacity(10, null, Buffers.BufferType.UNTRACKED, mockStats)
+ .capacity())
+ .isEqualTo(netBufferSize);
+ }
+
+ @Test
public void readAtLeast() throws Exception {
final int amountToRead = 150;
final int individualRead = 60;