Skip to content

Commit

Permalink
[FLINK-4894] [network] Fix hasData() and correctly clear buffer state
Browse files Browse the repository at this point in the history
  • Loading branch information
uce committed Oct 28, 2016
1 parent cc6655b commit 4b86701
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ public Buffer getCurrentBuffer() {
@Override
public void clearCurrentBuffer() {
targetBuffer = null;
position = 0;
limit = 0;
}

@Override
Expand All @@ -188,7 +190,7 @@ public void clear() {
@Override
public boolean hasData() {
// either data in current target buffer or intermediate buffers
return (this.position > 0 && this.position < this.limit) || (this.lengthBuffer.hasRemaining() || this.dataBuffer.hasRemaining());
return this.position > 0 || (this.lengthBuffer.hasRemaining() || this.dataBuffer.hasRemaining());
}

@Override
Expand Down

0 comments on commit 4b86701

Please sign in to comment.