Skip to content

Commit

Permalink
fix for onread listener
Browse files Browse the repository at this point in the history
  • Loading branch information
wizzardo committed Sep 30, 2023
1 parent d095c9a commit c7bd1bb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/com/wizzardo/http/HttpConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ public void setCloseOnFinishWriting(boolean closeOnFinishWriting) {

@Override
public void onRead(ByteBufferProvider bufferProvider) throws IOException {
if (readListener != null) {
if (inputStream != null && processingBy.get() != null) // there is a worker waiting for wakeup
readListener.onRead(this, bufferProvider);

// todo should probably reset processingBy immediately when there is 0 bytes to read
if (inputStream == null && processingBy.get() == null) // there is no worker trying to read
readListener.onRead(this, bufferProvider);
return;
}

server.process(this, bufferProvider);
}

Expand Down

0 comments on commit c7bd1bb

Please sign in to comment.