Guarded against NPE if the channel is not associated with the stream.
This commit is contained in:
parent
8fef113372
commit
5ad8f2a777
|
@ -140,15 +140,18 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Processing {} on {}", frame, stream);
|
LOG.debug("Processing {} on {}", frame, stream);
|
||||||
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
||||||
|
if (channel != null)
|
||||||
|
{
|
||||||
Runnable task = channel.onRequestContent(frame, callback);
|
Runnable task = channel.onRequestContent(frame, callback);
|
||||||
if (task != null)
|
if (task != null)
|
||||||
offerTask(task, false);
|
offerTask(task, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onStreamTimeout(IStream stream, Throwable failure)
|
public boolean onStreamTimeout(IStream stream, Throwable failure)
|
||||||
{
|
{
|
||||||
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
||||||
boolean result = channel.onStreamTimeout(failure);
|
boolean result = channel != null && channel.onStreamTimeout(failure);
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("{} idle timeout on {}: {}", result ? "Processed" : "Ignored", stream, failure);
|
LOG.debug("{} idle timeout on {}: {}", result ? "Processed" : "Ignored", stream, failure);
|
||||||
return result;
|
return result;
|
||||||
|
@ -159,6 +162,7 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Processing failure on {}: {}", stream, failure);
|
LOG.debug("Processing failure on {}: {}", stream, failure);
|
||||||
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
||||||
|
if (channel != null)
|
||||||
channel.onFailure(failure);
|
channel.onFailure(failure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,6 +173,7 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection
|
||||||
for (Stream stream : session.getStreams())
|
for (Stream stream : session.getStreams())
|
||||||
{
|
{
|
||||||
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
||||||
|
if (channel != null)
|
||||||
result &= !channel.isRequestHandled();
|
result &= !channel.isRequestHandled();
|
||||||
}
|
}
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
|
|
|
@ -215,6 +215,7 @@ public class HttpTransportOverHTTP2 implements HttpTransport
|
||||||
// Consume the existing queued data frames to
|
// Consume the existing queued data frames to
|
||||||
// avoid stalling the session flow control.
|
// avoid stalling the session flow control.
|
||||||
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE);
|
||||||
|
if (channel != null)
|
||||||
channel.consumeInput();
|
channel.consumeInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue