Bill commented on a change in pull request #7449:
URL: https://github.com/apache/geode/pull/7449#discussion_r836924146
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
##########
@@ -248,12 +248,24 @@ public ByteBufferSharing wrap(ByteBuffer appData) throws
IOException {
SSLEngineResult wrapResult = engine.wrap(appData, myNetData);
- if (wrapResult.getHandshakeStatus() == NEED_TASK) {
- handleBlockingTasks();
+ switch (wrapResult.getStatus()) {
+ case BUFFER_UNDERFLOW:
+ throw new SSLException("Error encrypting data: " + wrapResult);
+ case BUFFER_OVERFLOW:
+ write(channel, myNetData);
Review comment:
I agree that seems odd.
It’s not visible in this Github diff, but at the head of the `while()` loop
we grow `myNetData` if it does not have space for `2 * appData.remaining()`.
That growth logic is unchanged by this PR.
Following this code in the debugger (while running the
`secureDataTransferTest()`) it's apparent that when the `SSLEngine` returns
`BUFFER_OVERFLOW` the buffer (`myNetData`) is in fact not overflown (it is in
no danger of overflowing). There is plenty of room in that buffer. Resizing it
won't help in this case and removing this `write()` causes the `while()` loop
to never terminate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]