Commit 53736a6
Fix unwrapping loop in case bytebuffer has exactly 1 handshake message
In the scenario where the reading ByteBuffer only has enough bytes to
unwrap one handshake message, the flow may enter a loop due to the call
to ByteBuffer.clear(). That method does not actually erase any data,
instead it sets the position back to 0, the limit to the capacity, and
the mark is discarded. Since we are doing another unwrap attempt using
the same reading ByteBuffer, the same handshake message will be read.
Updating the reading ByteBuffer position instead of trying to clear it
will result in a BUFFER_UNDERFLOW, which will then trigger another read
from the channel (as expected).
(cherry picked from commit 7382a33)1 parent febcccd commit 53736a6
File tree
1 file changed
+2
-8
lines changed- src/main/java/com/rabbitmq/client/impl/nio
1 file changed
+2
-8
lines changedLines changed: 2 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 122 | + | |
129 | 123 | | |
130 | 124 | | |
131 | 125 | | |
| |||
0 commit comments