forked from quic-go/quic-go
only take specific values from the params map
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
// ConnectionParametersManager stores the connection parameters
|
||||
// Warning: Writes may only be done from the crypto stream, see the comment
|
||||
// in GetSHLOMap().
|
||||
// TODO: Separate our SFCW from the client's
|
||||
type ConnectionParametersManager struct {
|
||||
params map[Tag][]byte
|
||||
mutex sync.RWMutex
|
||||
@@ -37,7 +38,10 @@ func NewConnectionParamatersManager() *ConnectionParametersManager {
|
||||
func (h *ConnectionParametersManager) SetFromMap(params map[Tag][]byte) error {
|
||||
h.mutex.Lock()
|
||||
for key, value := range params {
|
||||
h.params[key] = value
|
||||
switch key {
|
||||
case TagSFCW, TagCFCW, TagICSL, TagMSPC:
|
||||
h.params[key] = value
|
||||
}
|
||||
}
|
||||
h.mutex.Unlock()
|
||||
return nil
|
||||
|
||||
@@ -15,20 +15,14 @@ var _ = Describe("ConnectionsParameterManager", func() {
|
||||
})
|
||||
|
||||
It("stores and retrieves a value", func() {
|
||||
kexs := []byte{0xDE, 0xCA, 0xFB, 0xAD}
|
||||
icsl := []byte{0x13, 0x37}
|
||||
values := map[Tag][]byte{
|
||||
TagKEXS: kexs,
|
||||
TagICSL: icsl,
|
||||
}
|
||||
|
||||
cpm.SetFromMap(values)
|
||||
|
||||
val, err := cpm.GetRawValue(TagKEXS)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(val).To(Equal(kexs))
|
||||
|
||||
val, err = cpm.GetRawValue(TagICSL)
|
||||
val, err := cpm.GetRawValue(TagICSL)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(val).To(Equal(icsl))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user