use of org.eclipse.jetty.http2.frames.Frame in project jetty.project by eclipse.
the class HTTP2Stream method onData.
private void onData(DataFrame frame, Callback callback) {
if (getRecvWindow() < 0) {
// It's a bad client, it does not deserve to be
// treated gently by just resetting the stream.
session.close(ErrorCode.FLOW_CONTROL_ERROR.code, "stream_window_exceeded", Callback.NOOP);
callback.failed(new IOException("stream_window_exceeded"));
return;
}
// SPEC: remotely closed streams must be replied with a reset.
if (isRemotelyClosed()) {
reset(new ResetFrame(streamId, ErrorCode.STREAM_CLOSED_ERROR.code), Callback.NOOP);
callback.failed(new EOFException("stream_closed"));
return;
}
if (isReset()) {
// Just drop the frame.
callback.failed(new IOException("stream_reset"));
return;
}
if (updateClose(frame.isEndStream(), false))
session.removeStream(this);
notifyData(this, frame, callback);
}
use of org.eclipse.jetty.http2.frames.Frame in project jetty.project by eclipse.
the class SimpleFlowControlStrategy method onDataConsumed.
@Override
public void onDataConsumed(ISession session, IStream stream, int length) {
if (length <= 0)
return;
// This is the simple algorithm for flow control.
// This method is called when a whole flow controlled frame has been consumed.
// We send a WindowUpdate every time, even if the frame was very small.
WindowUpdateFrame sessionFrame = new WindowUpdateFrame(0, length);
session.updateRecvWindow(length);
if (LOG.isDebugEnabled())
LOG.debug("Data consumed, increased session recv window by {} for {}", length, session);
Frame[] streamFrame = Frame.EMPTY_ARRAY;
if (stream != null) {
if (stream.isClosed()) {
if (LOG.isDebugEnabled())
LOG.debug("Data consumed, ignoring update stream recv window by {} for closed {}", length, stream);
} else {
streamFrame = new Frame[1];
streamFrame[0] = new WindowUpdateFrame(stream.getId(), length);
stream.updateRecvWindow(length);
if (LOG.isDebugEnabled())
LOG.debug("Data consumed, increased stream recv window by {} for {}", length, stream);
}
}
session.frames(stream, Callback.NOOP, sessionFrame, streamFrame);
}
use of org.eclipse.jetty.http2.frames.Frame in project jetty.project by eclipse.
the class HeadersBodyParser method onHeaders.
private void onHeaders(int parentStreamId, int weight, boolean exclusive, MetaData metaData) {
PriorityFrame priorityFrame = null;
if (hasFlag(Flags.PRIORITY))
priorityFrame = new PriorityFrame(getStreamId(), parentStreamId, weight, exclusive);
HeadersFrame frame = new HeadersFrame(getStreamId(), metaData, priorityFrame, isEndStream());
notifyHeaders(frame);
}
use of org.eclipse.jetty.http2.frames.Frame in project jetty.project by eclipse.
the class PriorityBodyParser method onPriority.
private boolean onPriority(int parentStreamId, int weight, boolean exclusive) {
PriorityFrame frame = new PriorityFrame(getStreamId(), parentStreamId, weight, exclusive);
reset();
notifyPriority(frame);
return true;
}
use of org.eclipse.jetty.http2.frames.Frame in project jetty.project by eclipse.
the class PushPromiseBodyParser method onPushPromise.
private void onPushPromise(int streamId, MetaData metaData) {
PushPromiseFrame frame = new PushPromiseFrame(getStreamId(), streamId, metaData);
notifyPushPromise(frame);
}
Aggregations