forked from quic-go/quic-go
@@ -130,12 +130,15 @@ func (h *ConnectionParametersManager) GetSHLOMap() map[Tag][]byte {
|
|||||||
utils.WriteUint32(cfcw, uint32(h.GetReceiveConnectionFlowControlWindow()))
|
utils.WriteUint32(cfcw, uint32(h.GetReceiveConnectionFlowControlWindow()))
|
||||||
mspc := bytes.NewBuffer([]byte{})
|
mspc := bytes.NewBuffer([]byte{})
|
||||||
utils.WriteUint32(mspc, h.GetMaxStreamsPerConnection())
|
utils.WriteUint32(mspc, h.GetMaxStreamsPerConnection())
|
||||||
|
mids := bytes.NewBuffer([]byte{})
|
||||||
|
utils.WriteUint32(mids, protocol.MaxIncomingDynamicStreams)
|
||||||
icsl := bytes.NewBuffer([]byte{})
|
icsl := bytes.NewBuffer([]byte{})
|
||||||
utils.WriteUint32(icsl, uint32(h.GetIdleConnectionStateLifetime()/time.Second))
|
utils.WriteUint32(icsl, uint32(h.GetIdleConnectionStateLifetime()/time.Second))
|
||||||
|
|
||||||
return map[Tag][]byte{
|
return map[Tag][]byte{
|
||||||
TagICSL: icsl.Bytes(),
|
TagICSL: icsl.Bytes(),
|
||||||
TagMSPC: mspc.Bytes(),
|
TagMSPC: mspc.Bytes(),
|
||||||
|
TagMIDS: mids.Bytes(),
|
||||||
TagCFCW: cfcw.Bytes(),
|
TagCFCW: cfcw.Bytes(),
|
||||||
TagSFCW: sfcw.Bytes(),
|
TagSFCW: sfcw.Bytes(),
|
||||||
}
|
}
|
||||||
@@ -145,7 +148,6 @@ func (h *ConnectionParametersManager) GetSHLOMap() map[Tag][]byte {
|
|||||||
func (h *ConnectionParametersManager) GetSendStreamFlowControlWindow() protocol.ByteCount {
|
func (h *ConnectionParametersManager) GetSendStreamFlowControlWindow() protocol.ByteCount {
|
||||||
h.mutex.RLock()
|
h.mutex.RLock()
|
||||||
defer h.mutex.RUnlock()
|
defer h.mutex.RUnlock()
|
||||||
|
|
||||||
return h.sendStreamFlowControlWindow
|
return h.sendStreamFlowControlWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +155,6 @@ func (h *ConnectionParametersManager) GetSendStreamFlowControlWindow() protocol.
|
|||||||
func (h *ConnectionParametersManager) GetSendConnectionFlowControlWindow() protocol.ByteCount {
|
func (h *ConnectionParametersManager) GetSendConnectionFlowControlWindow() protocol.ByteCount {
|
||||||
h.mutex.RLock()
|
h.mutex.RLock()
|
||||||
defer h.mutex.RUnlock()
|
defer h.mutex.RUnlock()
|
||||||
|
|
||||||
return h.sendConnectionFlowControlWindow
|
return h.sendConnectionFlowControlWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +162,6 @@ func (h *ConnectionParametersManager) GetSendConnectionFlowControlWindow() proto
|
|||||||
func (h *ConnectionParametersManager) GetReceiveStreamFlowControlWindow() protocol.ByteCount {
|
func (h *ConnectionParametersManager) GetReceiveStreamFlowControlWindow() protocol.ByteCount {
|
||||||
h.mutex.RLock()
|
h.mutex.RLock()
|
||||||
defer h.mutex.RUnlock()
|
defer h.mutex.RUnlock()
|
||||||
|
|
||||||
return h.receiveStreamFlowControlWindow
|
return h.receiveStreamFlowControlWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +169,6 @@ func (h *ConnectionParametersManager) GetReceiveStreamFlowControlWindow() protoc
|
|||||||
func (h *ConnectionParametersManager) GetReceiveConnectionFlowControlWindow() protocol.ByteCount {
|
func (h *ConnectionParametersManager) GetReceiveConnectionFlowControlWindow() protocol.ByteCount {
|
||||||
h.mutex.RLock()
|
h.mutex.RLock()
|
||||||
defer h.mutex.RUnlock()
|
defer h.mutex.RUnlock()
|
||||||
|
|
||||||
return h.receiveConnectionFlowControlWindow
|
return h.receiveConnectionFlowControlWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +176,6 @@ func (h *ConnectionParametersManager) GetReceiveConnectionFlowControlWindow() pr
|
|||||||
func (h *ConnectionParametersManager) GetMaxStreamsPerConnection() uint32 {
|
func (h *ConnectionParametersManager) GetMaxStreamsPerConnection() uint32 {
|
||||||
h.mutex.RLock()
|
h.mutex.RLock()
|
||||||
defer h.mutex.RUnlock()
|
defer h.mutex.RUnlock()
|
||||||
|
|
||||||
return h.maxStreamsPerConnection
|
return h.maxStreamsPerConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +183,6 @@ func (h *ConnectionParametersManager) GetMaxStreamsPerConnection() uint32 {
|
|||||||
func (h *ConnectionParametersManager) GetIdleConnectionStateLifetime() time.Duration {
|
func (h *ConnectionParametersManager) GetIdleConnectionStateLifetime() time.Duration {
|
||||||
h.mutex.RLock()
|
h.mutex.RLock()
|
||||||
defer h.mutex.RUnlock()
|
defer h.mutex.RUnlock()
|
||||||
|
|
||||||
return h.idleConnectionStateLifetime
|
return h.idleConnectionStateLifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ var _ = Describe("ConnectionsParameterManager", func() {
|
|||||||
entryMap := cpm.GetSHLOMap()
|
entryMap := cpm.GetSHLOMap()
|
||||||
Expect(entryMap).To(HaveKey(TagICSL))
|
Expect(entryMap).To(HaveKey(TagICSL))
|
||||||
Expect(entryMap).To(HaveKey(TagMSPC))
|
Expect(entryMap).To(HaveKey(TagMSPC))
|
||||||
|
Expect(entryMap).To(HaveKey(TagMIDS))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("sets the stream-level flow control windows in SHLO", func() {
|
It("sets the stream-level flow control windows in SHLO", func() {
|
||||||
@@ -66,6 +67,12 @@ var _ = Describe("ConnectionsParameterManager", func() {
|
|||||||
Expect(entryMap).To(HaveKey(TagMSPC))
|
Expect(entryMap).To(HaveKey(TagMSPC))
|
||||||
Expect(entryMap[TagMSPC]).To(Equal([]byte{0xEF, 0xBE, 0xAD, 0xDE}))
|
Expect(entryMap[TagMSPC]).To(Equal([]byte{0xEF, 0xBE, 0xAD, 0xDE}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("sets the maximum incoming dynamic streams per connection in SHLO", func() {
|
||||||
|
entryMap := cpm.GetSHLOMap()
|
||||||
|
Expect(entryMap).To(HaveKey(TagMIDS))
|
||||||
|
Expect(entryMap[TagMIDS]).To(Equal([]byte{100, 0, 0, 0}))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Context("Truncated connection IDs", func() {
|
Context("Truncated connection IDs", func() {
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ const (
|
|||||||
TagCCRT Tag = 'C' + 'C'<<8 + 'R'<<16 + 'T'<<24
|
TagCCRT Tag = 'C' + 'C'<<8 + 'R'<<16 + 'T'<<24
|
||||||
// TagMSPC is max streams per connection
|
// TagMSPC is max streams per connection
|
||||||
TagMSPC Tag = 'M' + 'S'<<8 + 'P'<<16 + 'C'<<24
|
TagMSPC Tag = 'M' + 'S'<<8 + 'P'<<16 + 'C'<<24
|
||||||
|
// TagMIDS is max incoming dyanamic streams
|
||||||
|
TagMIDS Tag = 'M' + 'I'<<8 + 'D'<<16 + 'S'<<24
|
||||||
// TagUAID is the user agent ID
|
// TagUAID is the user agent ID
|
||||||
TagUAID Tag = 'U' + 'A'<<8 + 'I'<<16 + 'D'<<24
|
TagUAID Tag = 'U' + 'A'<<8 + 'I'<<16 + 'D'<<24
|
||||||
// TagTCID is truncation of the connection ID
|
// TagTCID is truncation of the connection ID
|
||||||
|
|||||||
@@ -31,9 +31,15 @@ const ReceiveConnectionFlowControlWindow ByteCount = (1 << 20) * 1.5 // 1.5 MB
|
|||||||
// MaxStreamsPerConnection is the maximum value accepted for the number of streams per connection
|
// MaxStreamsPerConnection is the maximum value accepted for the number of streams per connection
|
||||||
const MaxStreamsPerConnection uint32 = 100
|
const MaxStreamsPerConnection uint32 = 100
|
||||||
|
|
||||||
// MaxStreamsMultiplier is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped.
|
// MaxIncomingDynamicStreams is the maximum value accepted for the incoming number of dynamic streams per connection
|
||||||
|
const MaxIncomingDynamicStreams uint32 = 100
|
||||||
|
|
||||||
|
// MaxStreamsMultiplier is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped. The minimum of this procentual increase and the absolute increment specified by MaxStreamsMinimumIncrement is used.
|
||||||
const MaxStreamsMultiplier = 1.1
|
const MaxStreamsMultiplier = 1.1
|
||||||
|
|
||||||
|
// MaxStreamsMinimumIncrement is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped. The minimum of this absolute increment and the procentual increase specified by MaxStreamsMultiplier is used.
|
||||||
|
const MaxStreamsMinimumIncrement = 10
|
||||||
|
|
||||||
// MaxIdleConnectionStateLifetime is the maximum value accepted for the idle connection state lifetime
|
// MaxIdleConnectionStateLifetime is the maximum value accepted for the idle connection state lifetime
|
||||||
// TODO: set a reasonable value here
|
// TODO: set a reasonable value here
|
||||||
const MaxIdleConnectionStateLifetime = 60 * time.Second
|
const MaxIdleConnectionStateLifetime = 60 * time.Second
|
||||||
|
|||||||
Reference in New Issue
Block a user