Skip to content

Commit

Permalink
[UNDERTOW-2298] Avoid NPE on concurrent close/timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
baranowb committed Jul 31, 2023
1 parent 7d87eef commit 359aa15
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ public int read(final byte[] b, final int off, final int len) throws IOException

private void readIntoBuffer() throws IOException {
if (pooled == null && !anyAreSet(state, FLAG_FINISHED)) {
pooled = bufferPool.allocate();
final PooledByteBuffer localPooled = pooled = bufferPool.allocate();

int res = Channels.readBlocking(channel, pooled.getBuffer());
pooled.getBuffer().flip();
int res = Channels.readBlocking(channel, localPooled.getBuffer());
localPooled.getBuffer().flip();
if (res == -1) {
setFlags(FLAG_FINISHED);
pooled.close();
Expand Down

0 comments on commit 359aa15

Please sign in to comment.