Skip to content

Commit

Permalink
Fixes #5691 - HttpInput may skip setting fill interest.
Browse files Browse the repository at this point in the history
Updates after review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Nov 21, 2020
1 parent a2c0818 commit 1ac0af4
Showing 1 changed file with 25 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,48 +219,37 @@ public void reclaim(HttpInput.Content content)
public boolean isReady()
{
HttpInput.Content content = nextTransformedContent();
if (content == null)
if (content != null)
{
_httpChannel.getState().onReadUnready();
while (true)
{
if (_httpChannel.needContent())
{
content = nextTransformedContent();
if (LOG.isDebugEnabled())
LOG.debug("isReady got transformed content after needContent retry {} {}", content, this);
if (content != null)
{
_httpChannel.getState().onContentAdded();
break;
}
else
{
// We could have read some rawContent but not enough to generate
// transformed content, so we need to call needContent() again
// to tell the channel that more content is needed.
if (LOG.isDebugEnabled())
LOG.debug("isReady could not transform content after needContent retry {}", this);
}
}
else
{
if (LOG.isDebugEnabled())
LOG.debug("isReady false needContent retry {}", this);
break;
}
}
if (LOG.isDebugEnabled())
LOG.debug("isReady(), got transformed content {} {}", content, this);
_httpChannel.getState().onContentAdded();
return true;
}
else

_httpChannel.getState().onReadUnready();
while (_httpChannel.needContent())
{
content = nextTransformedContent();
if (LOG.isDebugEnabled())
LOG.debug("isReady got transformed content {} {}", content, this);
_httpChannel.getState().onContentAdded();
LOG.debug("isReady(), got transformed content after needContent retry {} {}", content, this);
if (content != null)
{
_httpChannel.getState().onContentAdded();
return true;
}
else
{
// We could have read some rawContent but not enough to generate
// transformed content, so we need to call needContent() again
// to tell the channel that more content is needed.
if (LOG.isDebugEnabled())
LOG.debug("isReady(), could not transform content after needContent retry {}", this);
}
}
boolean ready = content != null;
if (LOG.isDebugEnabled())
LOG.debug("isReady = {}", ready);
return ready;
LOG.debug("isReady(), no content for needContent retry {}", this);
return false;
}

private HttpInput.Content nextTransformedContent()
Expand Down

0 comments on commit 1ac0af4

Please sign in to comment.