Refactored isRequestHandled() logic to use HttpChannelState.

This commit is contained in:
Simone Bordet 2017-08-07 10:41:46 +02:00
parent 7b437cd647
commit 93e8af1db5
1 changed files with 2 additions and 7 deletions

View File

@ -53,7 +53,6 @@ public class HttpChannelOverHTTP2 extends HttpChannel
private boolean _expect100Continue; private boolean _expect100Continue;
private boolean _delayedUntilContent; private boolean _delayedUntilContent;
private boolean _handled;
public HttpChannelOverHTTP2(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransportOverHTTP2 transport) public HttpChannelOverHTTP2(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransportOverHTTP2 transport)
{ {
@ -121,7 +120,6 @@ public class HttpChannelOverHTTP2 extends HttpChannel
_delayedUntilContent = getHttpConfiguration().isDelayDispatchUntilContent() && _delayedUntilContent = getHttpConfiguration().isDelayDispatchUntilContent() &&
!endStream && !_expect100Continue; !endStream && !_expect100Continue;
_handled = !_delayedUntilContent;
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
{ {
@ -190,7 +188,6 @@ public class HttpChannelOverHTTP2 extends HttpChannel
{ {
_expect100Continue = false; _expect100Continue = false;
_delayedUntilContent = false; _delayedUntilContent = false;
_handled = false;
super.recycle(); super.recycle();
getHttpTransport().recycle(); getHttpTransport().recycle();
} }
@ -277,19 +274,17 @@ public class HttpChannelOverHTTP2 extends HttpChannel
boolean wasDelayed = _delayedUntilContent; boolean wasDelayed = _delayedUntilContent;
_delayedUntilContent = false; _delayedUntilContent = false;
if (wasDelayed)
_handled = true;
return handle || wasDelayed ? this : null; return handle || wasDelayed ? this : null;
} }
public boolean isRequestHandled() public boolean isRequestHandled()
{ {
return _handled; return !getState().isIdle();
} }
public boolean onStreamTimeout(Throwable failure) public boolean onStreamTimeout(Throwable failure)
{ {
if (!_handled) if (!isRequestHandled())
return true; return true;
HttpInput input = getRequest().getHttpInput(); HttpInput input = getRequest().getHttpInput();