Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.
This commit is contained in:
commit
186ad447de
|
@ -1220,7 +1220,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
|
|||
|
||||
private class DataEntry extends HTTP2Flusher.Entry
|
||||
{
|
||||
private long bytes;
|
||||
private int bytes;
|
||||
private int dataRemaining;
|
||||
private int dataWritten;
|
||||
|
||||
|
@ -1255,7 +1255,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
|
|||
|
||||
// Only one DATA frame is generated.
|
||||
bytes = generator.data(lease, (DataFrame)frame, length);
|
||||
int written = (int)bytes - Frame.HEADER_LENGTH;
|
||||
int written = bytes - Frame.HEADER_LENGTH;
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Generated {}, length/window/data={}/{}/{}", frame, written, window, dataRemaining);
|
||||
|
||||
|
|
|
@ -36,12 +36,12 @@ public class DataGenerator
|
|||
this.headerGenerator = headerGenerator;
|
||||
}
|
||||
|
||||
public long generate(ByteBufferPool.Lease lease, DataFrame frame, int maxLength)
|
||||
public int generate(ByteBufferPool.Lease lease, DataFrame frame, int maxLength)
|
||||
{
|
||||
return generateData(lease, frame.getStreamId(), frame.getData(), frame.isEndStream(), maxLength);
|
||||
}
|
||||
|
||||
public long generateData(ByteBufferPool.Lease lease, int streamId, ByteBuffer data, boolean last, int maxLength)
|
||||
public int generateData(ByteBufferPool.Lease lease, int streamId, ByteBuffer data, boolean last, int maxLength)
|
||||
{
|
||||
if (streamId < 0)
|
||||
throw new IllegalArgumentException("Invalid stream id: " + streamId);
|
||||
|
|
|
@ -29,7 +29,7 @@ public class DisconnectGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public abstract class FrameGenerator
|
|||
this.headerGenerator = headerGenerator;
|
||||
}
|
||||
|
||||
public abstract long generate(ByteBufferPool.Lease lease, Frame frame);
|
||||
public abstract int generate(ByteBufferPool.Lease lease, Frame frame);
|
||||
|
||||
protected ByteBuffer generateHeader(ByteBufferPool.Lease lease, FrameType frameType, int length, int flags, int streamId)
|
||||
{
|
||||
|
|
|
@ -75,12 +75,12 @@ public class Generator
|
|||
headerGenerator.setMaxFrameSize(maxFrameSize);
|
||||
}
|
||||
|
||||
public long control(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int control(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
return generators[frame.getType().getType()].generate(lease, frame);
|
||||
}
|
||||
|
||||
public long data(ByteBufferPool.Lease lease, DataFrame frame, int maxLength)
|
||||
public int data(ByteBufferPool.Lease lease, DataFrame frame, int maxLength)
|
||||
{
|
||||
return dataGenerator.generate(lease, frame, maxLength);
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@ public class GoAwayGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
GoAwayFrame goAwayFrame = (GoAwayFrame)frame;
|
||||
return generateGoAway(lease, goAwayFrame.getLastStreamId(), goAwayFrame.getError(), goAwayFrame.getPayload());
|
||||
}
|
||||
|
||||
public long generateGoAway(ByteBufferPool.Lease lease, int lastStreamId, int error, byte[] payload)
|
||||
public int generateGoAway(ByteBufferPool.Lease lease, int lastStreamId, int error, byte[] payload)
|
||||
{
|
||||
if (lastStreamId < 0)
|
||||
throw new IllegalArgumentException("Invalid last stream id: " + lastStreamId);
|
||||
|
|
|
@ -50,13 +50,13 @@ public class HeadersGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
HeadersFrame headersFrame = (HeadersFrame)frame;
|
||||
return generateHeaders(lease, headersFrame.getStreamId(), headersFrame.getMetaData(), headersFrame.getPriority(), headersFrame.isEndStream());
|
||||
}
|
||||
|
||||
public long generateHeaders(ByteBufferPool.Lease lease, int streamId, MetaData metaData, PriorityFrame priority, boolean endStream)
|
||||
public int generateHeaders(ByteBufferPool.Lease lease, int streamId, MetaData metaData, PriorityFrame priority, boolean endStream)
|
||||
{
|
||||
if (streamId < 0)
|
||||
throw new IllegalArgumentException("Invalid stream id: " + streamId);
|
||||
|
|
|
@ -35,13 +35,13 @@ public class PingGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
PingFrame pingFrame = (PingFrame)frame;
|
||||
return generatePing(lease, pingFrame.getPayload(), pingFrame.isReply());
|
||||
}
|
||||
|
||||
public long generatePing(ByteBufferPool.Lease lease, byte[] payload, boolean reply)
|
||||
public int generatePing(ByteBufferPool.Lease lease, byte[] payload, boolean reply)
|
||||
{
|
||||
if (payload.length != PingFrame.PING_LENGTH)
|
||||
throw new IllegalArgumentException("Invalid payload length: " + payload.length);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class PrefaceGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
lease.append(ByteBuffer.wrap(PrefaceFrame.PREFACE_BYTES), false);
|
||||
return PrefaceFrame.PREFACE_BYTES.length;
|
||||
|
|
|
@ -35,13 +35,13 @@ public class PriorityGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
PriorityFrame priorityFrame = (PriorityFrame)frame;
|
||||
return generatePriority(lease, priorityFrame.getStreamId(), priorityFrame.getParentStreamId(), priorityFrame.getWeight(), priorityFrame.isExclusive());
|
||||
}
|
||||
|
||||
public long generatePriority(ByteBufferPool.Lease lease, int streamId, int parentStreamId, int weight, boolean exclusive)
|
||||
public int generatePriority(ByteBufferPool.Lease lease, int streamId, int parentStreamId, int weight, boolean exclusive)
|
||||
{
|
||||
ByteBuffer header = generateHeader(lease, FrameType.PRIORITY, PriorityFrame.PRIORITY_LENGTH, Flags.NONE, streamId);
|
||||
generatePriorityBody(header, streamId, parentStreamId, weight, exclusive);
|
||||
|
|
|
@ -40,13 +40,13 @@ public class PushPromiseGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
PushPromiseFrame pushPromiseFrame = (PushPromiseFrame)frame;
|
||||
return generatePushPromise(lease, pushPromiseFrame.getStreamId(), pushPromiseFrame.getPromisedStreamId(), pushPromiseFrame.getMetaData());
|
||||
}
|
||||
|
||||
public long generatePushPromise(ByteBufferPool.Lease lease, int streamId, int promisedStreamId, MetaData metaData)
|
||||
public int generatePushPromise(ByteBufferPool.Lease lease, int streamId, int promisedStreamId, MetaData metaData)
|
||||
{
|
||||
if (streamId < 0)
|
||||
throw new IllegalArgumentException("Invalid stream id: " + streamId);
|
||||
|
|
|
@ -35,13 +35,13 @@ public class ResetGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
ResetFrame resetFrame = (ResetFrame)frame;
|
||||
return generateReset(lease, resetFrame.getStreamId(), resetFrame.getError());
|
||||
}
|
||||
|
||||
public long generateReset(ByteBufferPool.Lease lease, int streamId, int error)
|
||||
public int generateReset(ByteBufferPool.Lease lease, int streamId, int error)
|
||||
{
|
||||
if (streamId < 0)
|
||||
throw new IllegalArgumentException("Invalid stream id: " + streamId);
|
||||
|
|
|
@ -36,13 +36,13 @@ public class SettingsGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
SettingsFrame settingsFrame = (SettingsFrame)frame;
|
||||
return generateSettings(lease, settingsFrame.getSettings(), settingsFrame.isReply());
|
||||
}
|
||||
|
||||
public long generateSettings(ByteBufferPool.Lease lease, Map<Integer, Integer> settings, boolean reply)
|
||||
public int generateSettings(ByteBufferPool.Lease lease, Map<Integer, Integer> settings, boolean reply)
|
||||
{
|
||||
// Two bytes for the identifier, four bytes for the value.
|
||||
int entryLength = 2 + 4;
|
||||
|
|
|
@ -35,13 +35,13 @@ public class WindowUpdateGenerator extends FrameGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public long generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
public int generate(ByteBufferPool.Lease lease, Frame frame)
|
||||
{
|
||||
WindowUpdateFrame windowUpdateFrame = (WindowUpdateFrame)frame;
|
||||
return generateWindowUpdate(lease, windowUpdateFrame.getStreamId(), windowUpdateFrame.getWindowDelta());
|
||||
}
|
||||
|
||||
public long generateWindowUpdate(ByteBufferPool.Lease lease, int streamId, int windowUpdate)
|
||||
public int generateWindowUpdate(ByteBufferPool.Lease lease, int streamId, int windowUpdate)
|
||||
{
|
||||
if (windowUpdate < 0)
|
||||
throw new IllegalArgumentException("Invalid window update: " + windowUpdate);
|
||||
|
|
Loading…
Reference in New Issue