Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Orban <[email protected]>
  • Loading branch information
lorban committed Aug 16, 2024
1 parent 7807703 commit 6e9d184
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ protected void responseContentAvailable(HttpExchange exchange)
// There are then two processDemand() invocations enqueued, and since they call HttpReceiver.read(true) when no content is readily available,
// they can both try to register fill interest and eventually throw a ReadPendingException.
// So onDataAvailable() must always be executed from the invoker but also immediately.
// The root cause is that for H1/FCGI the parser calls this method not knowing if it is reacting to a read() or a demand().
// Make sure these 3 tests pass when modifying this method:
// - ForwardProxyWithDynamicTransportTest.testProxyConcurrentLoad()
// - ConnectionPoolTest.testConnectionPoolFactory()
// - HttpClientTest.testContentSourceListenerDemandInSpawnedThread()

Runnable runnable = () ->
{
Expand All @@ -350,7 +355,7 @@ protected void responseContentAvailable(HttpExchange exchange)
LOG.debug("{} responseContentAvailable on {}", invoker.isCurrentThreadInvoking() ? "Invoking" : "Calling", this);

if (invoker.isCurrentThreadInvoking())
runnable.run();
runnable.run(); // This is needed by H2, but it could be just return for h1/fcgi. ForwardProxyWithDynamicTransportTest.testProxyConcurrentLoad fails when we do not run the runnable here.
else
invoker.run(runnable);
}
Expand Down

0 comments on commit 6e9d184

Please sign in to comment.