forked from quic-go/quic-go
use protocol.ByteCount in frames, streams and session
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/protocol"
|
||||
)
|
||||
|
||||
// ConnectionParametersManager stores the connection parameters
|
||||
@@ -61,7 +63,7 @@ func (h *ConnectionParametersManager) GetSHLOMap() map[Tag][]byte {
|
||||
}
|
||||
|
||||
// GetStreamFlowControlWindow gets the size of the stream-level flow control window
|
||||
func (h *ConnectionParametersManager) GetStreamFlowControlWindow() (uint32, error) {
|
||||
func (h *ConnectionParametersManager) GetStreamFlowControlWindow() (protocol.ByteCount, error) {
|
||||
rawValue, err := h.GetRawValue(TagSFCW)
|
||||
|
||||
if err != nil {
|
||||
@@ -75,5 +77,5 @@ func (h *ConnectionParametersManager) GetStreamFlowControlWindow() (uint32, erro
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return value, nil
|
||||
return protocol.ByteCount(value), nil
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package handshake
|
||||
|
||||
import (
|
||||
"github.com/lucas-clemente/quic-go/protocol"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
@@ -46,14 +47,14 @@ var _ = Describe("ConnectionsParameterManager", func() {
|
||||
It("has the correct default flow control window", func() {
|
||||
val, err := cpm.GetStreamFlowControlWindow()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(val).To(Equal(uint32(0x4000)))
|
||||
Expect(val).To(Equal(protocol.ByteCount(0x4000)))
|
||||
})
|
||||
|
||||
It("reads the stream-level flowControlWindow", func() {
|
||||
cpm.params[TagSFCW] = []byte{0xDE, 0xAD, 0xBE, 0xEF}
|
||||
val, err := cpm.GetStreamFlowControlWindow()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(val).To(Equal(uint32(0xEFBEADDE)))
|
||||
Expect(val).To(Equal(protocol.ByteCount(0xEFBEADDE)))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user