Fix #5605 Unblock non container Threads

Don't consumeAll before upgrade
This commit is contained in:
gregw 2021-02-03 11:03:02 +01:00
parent a110fc3468
commit a100d80d26
1 changed files with 8 additions and 5 deletions

View File

@ -376,17 +376,15 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
@Override
public void onCompleted()
{
boolean complete = _input.consumeAll();
Throwable cancelled = getEndPoint().cancelFillInterest(_input::getError);
if (LOG.isDebugEnabled())
LOG.debug("cancelled {}", this, cancelled);
// Handle connection upgrades
if (_channel.getResponse().getStatus() == HttpStatus.SWITCHING_PROTOCOLS_101)
{
Connection connection = (Connection)_channel.getRequest().getAttribute(UPGRADE_CONNECTION_ATTRIBUTE);
if (connection != null)
{
Throwable cancelled = getEndPoint().cancelFillInterest(_input::getError);
if (LOG.isDebugEnabled())
LOG.debug("cancelled {}", this, cancelled);
if (LOG.isDebugEnabled())
LOG.debug("Upgrade from {} to {}", this, connection);
_channel.getState().upgrade();
@ -406,6 +404,11 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
}
}
boolean complete = _input.consumeAll();
Throwable cancelled = getEndPoint().cancelFillInterest(_input::getError);
if (LOG.isDebugEnabled())
LOG.debug("cancelled {}", this, cancelled);
// Finish consuming the request
// If we are still expecting
if (_channel.isExpecting100Continue())