use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class Level6LocalFlowControl method fireDataToClient.
public XFuture<Void> fireDataToClient(Stream stream, StreamMsg payload) {
if (!(payload instanceof DataFrame))
return notifyListener.sendPieceToApp(stream, payload);
DataFrame f = (DataFrame) payload;
long frameLength = f.getTransmitFrameLength();
if (frameLength > connectionLocalWindowSize) {
throw new ConnectionException(CancelReasonCode.FLOW_CONTROL_ERROR, logId, f.getStreamId(), "connectionLocalWindowSize too small=" + connectionLocalWindowSize + " frame len=" + frameLength + " for frame=" + f);
} else if (frameLength > stream.getLocalWindowSize()) {
throw new StreamException(CancelReasonCode.FLOW_CONTROL_ERROR, logId, f.getStreamId(), "connectionLocalWindowSize too small=" + connectionLocalWindowSize + " frame len=" + frameLength + " for frame=" + f);
}
totalSent += frameLength;
connectionLocalWindowSize -= frameLength;
stream.incrementLocalWindow(-frameLength);
log.info("received framelen=" + frameLength + " newConnectionWindowSize=" + connectionLocalWindowSize + " streamSize=" + stream.getLocalWindowSize() + " totalSent=" + totalSent);
return notifyListener.sendPieceToApp(stream, payload).thenApply(c -> updateFlowControl(frameLength, stream));
}
use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class Requests method createData.
public static DataFrame createData(int streamId, boolean eos) {
DataFrame data = new DataFrame(streamId, eos);
DataWrapper wrapByteArray = DATA_GEN.wrapByteArray(new byte[] { 2, 3 });
data.setData(wrapByteArray);
return data;
}
use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class Requests method createBigData.
public static DataFrame createBigData(int streamId, boolean eos) {
DataFrame data = new DataFrame(streamId, eos);
String s = "hi there, this is a bit more data so that we can test a few things out";
byte[] bytes = s.getBytes();
DataWrapper wrapByteArray = DATA_GEN.wrapByteArray(bytes);
data.setData(wrapByteArray);
return data;
}
use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class Http11ToHttp2 method translateChunk.
private static Http2Msg translateChunk(HttpChunk payload, boolean eos) {
DataFrame frame = new DataFrame();
frame.setData(payload.getBodyNonNull());
frame.setEndOfStream(eos);
return frame;
}
use of com.webpieces.http2.api.dto.lowlevel.DataFrame in project webpieces by deanhiller.
the class Http11ToHttp2 method translateData.
public static DataFrame translateData(HttpData payload) {
DataFrame frame = new DataFrame();
frame.setEndOfStream(payload.isEndOfData());
frame.setData(payload.getBodyNonNull());
return frame;
}
Aggregations