Used already calculated SETTINGS frame payload length when allocating ByteBuf
Motivation: We have already calculated the payload length. So no need to calculate again when allocating ByteBuf Modification: Used payloadLength variable instead of calculating the payload length again Result: Re-use the variable value and make the code cleaner
This commit is contained in:
parent
e27831d767
commit
8d7ffec081
@ -310,7 +310,7 @@ public class DefaultHttp2FrameWriter implements Http2FrameWriter, Http2FrameSize
|
||||
try {
|
||||
checkNotNull(settings, "settings");
|
||||
int payloadLength = SETTING_ENTRY_LENGTH * settings.size();
|
||||
ByteBuf buf = ctx.alloc().buffer(FRAME_HEADER_LENGTH + settings.size() * SETTING_ENTRY_LENGTH);
|
||||
ByteBuf buf = ctx.alloc().buffer(FRAME_HEADER_LENGTH + payloadLength);
|
||||
writeFrameHeaderInternal(buf, payloadLength, SETTINGS, new Http2Flags(), 0);
|
||||
for (Http2Settings.PrimitiveEntry<Long> entry : settings.entries()) {
|
||||
buf.writeChar(entry.key());
|
||||
|
Loading…
Reference in New Issue
Block a user