forked from quic-go/quic-go
Merge pull request #857 from lucas-clemente/maxpacketsize-handshake-param
send the maximum packet size in the TLS transport parameters
This commit is contained in:
@@ -88,11 +88,14 @@ func (h *paramsNegotiator) GetTransportParameters() []transportParameter {
|
|||||||
binary.BigEndian.PutUint32(initialMaxStreamID, math.MaxUint32)
|
binary.BigEndian.PutUint32(initialMaxStreamID, math.MaxUint32)
|
||||||
idleTimeout := make([]byte, 2)
|
idleTimeout := make([]byte, 2)
|
||||||
binary.BigEndian.PutUint16(idleTimeout, uint16(h.GetIdleConnectionStateLifetime().Seconds()))
|
binary.BigEndian.PutUint16(idleTimeout, uint16(h.GetIdleConnectionStateLifetime().Seconds()))
|
||||||
|
maxPacketSize := make([]byte, 2)
|
||||||
|
binary.BigEndian.PutUint16(maxPacketSize, uint16(protocol.MaxReceivePacketSize))
|
||||||
params := []transportParameter{
|
params := []transportParameter{
|
||||||
{initialMaxStreamDataParameterID, initialMaxStreamData},
|
{initialMaxStreamDataParameterID, initialMaxStreamData},
|
||||||
{initialMaxDataParameterID, initialMaxData},
|
{initialMaxDataParameterID, initialMaxData},
|
||||||
{initialMaxStreamIDParameterID, initialMaxStreamID},
|
{initialMaxStreamIDParameterID, initialMaxStreamID},
|
||||||
{idleTimeoutParameterID, idleTimeout},
|
{idleTimeoutParameterID, idleTimeout},
|
||||||
|
{maxPacketSizeParameterID, maxPacketSize},
|
||||||
}
|
}
|
||||||
h.mutex.RLock()
|
h.mutex.RLock()
|
||||||
defer h.mutex.RUnlock()
|
defer h.mutex.RUnlock()
|
||||||
|
|||||||
@@ -49,13 +49,14 @@ var _ = Describe("Params Negotiator (for TLS)", func() {
|
|||||||
It("creates the parameters list", func() {
|
It("creates the parameters list", func() {
|
||||||
buf := make([]byte, 4)
|
buf := make([]byte, 4)
|
||||||
values := paramsListToMap(pn.GetTransportParameters())
|
values := paramsListToMap(pn.GetTransportParameters())
|
||||||
Expect(values).To(HaveLen(4))
|
Expect(values).To(HaveLen(5))
|
||||||
binary.BigEndian.PutUint32(buf, uint32(protocol.ReceiveStreamFlowControlWindow))
|
binary.BigEndian.PutUint32(buf, uint32(protocol.ReceiveStreamFlowControlWindow))
|
||||||
Expect(values).To(HaveKeyWithValue(initialMaxStreamDataParameterID, buf))
|
Expect(values).To(HaveKeyWithValue(initialMaxStreamDataParameterID, buf))
|
||||||
binary.BigEndian.PutUint32(buf, uint32(protocol.ReceiveConnectionFlowControlWindow))
|
binary.BigEndian.PutUint32(buf, uint32(protocol.ReceiveConnectionFlowControlWindow))
|
||||||
Expect(values).To(HaveKeyWithValue(initialMaxDataParameterID, buf))
|
Expect(values).To(HaveKeyWithValue(initialMaxDataParameterID, buf))
|
||||||
Expect(values).To(HaveKeyWithValue(initialMaxStreamIDParameterID, []byte{0xff, 0xff, 0xff, 0xff}))
|
Expect(values).To(HaveKeyWithValue(initialMaxStreamIDParameterID, []byte{0xff, 0xff, 0xff, 0xff}))
|
||||||
Expect(values).To(HaveKeyWithValue(idleTimeoutParameterID, []byte{0x50, 0x0}))
|
Expect(values).To(HaveKeyWithValue(idleTimeoutParameterID, []byte{0x50, 0x0}))
|
||||||
|
Expect(values).To(HaveKeyWithValue(maxPacketSizeParameterID, []byte{0x5, 0xac})) // 1452 = 0x5ac
|
||||||
})
|
})
|
||||||
|
|
||||||
It("request ommision of the connection ID", func() {
|
It("request ommision of the connection ID", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user