forked from quic-go/quic-go
update the name of the disable_active_migration transport parameter
This commit is contained in:
@@ -77,7 +77,7 @@ var _ = Describe("Transport Parameters", func() {
|
|||||||
MaxIdleTimeout: 0xcafe * time.Second,
|
MaxIdleTimeout: 0xcafe * time.Second,
|
||||||
MaxBidiStreamNum: protocol.StreamNum(getRandomValue()),
|
MaxBidiStreamNum: protocol.StreamNum(getRandomValue()),
|
||||||
MaxUniStreamNum: protocol.StreamNum(getRandomValue()),
|
MaxUniStreamNum: protocol.StreamNum(getRandomValue()),
|
||||||
DisableMigration: true,
|
DisableActiveMigration: true,
|
||||||
StatelessResetToken: &token,
|
StatelessResetToken: &token,
|
||||||
OriginalConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
OriginalConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
||||||
AckDelayExponent: 13,
|
AckDelayExponent: 13,
|
||||||
@@ -95,7 +95,7 @@ var _ = Describe("Transport Parameters", func() {
|
|||||||
Expect(p.MaxUniStreamNum).To(Equal(params.MaxUniStreamNum))
|
Expect(p.MaxUniStreamNum).To(Equal(params.MaxUniStreamNum))
|
||||||
Expect(p.MaxBidiStreamNum).To(Equal(params.MaxBidiStreamNum))
|
Expect(p.MaxBidiStreamNum).To(Equal(params.MaxBidiStreamNum))
|
||||||
Expect(p.MaxIdleTimeout).To(Equal(params.MaxIdleTimeout))
|
Expect(p.MaxIdleTimeout).To(Equal(params.MaxIdleTimeout))
|
||||||
Expect(p.DisableMigration).To(Equal(params.DisableMigration))
|
Expect(p.DisableActiveMigration).To(Equal(params.DisableActiveMigration))
|
||||||
Expect(p.StatelessResetToken).To(Equal(params.StatelessResetToken))
|
Expect(p.StatelessResetToken).To(Equal(params.StatelessResetToken))
|
||||||
Expect(p.OriginalConnectionID).To(Equal(protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef}))
|
Expect(p.OriginalConnectionID).To(Equal(protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef}))
|
||||||
Expect(p.AckDelayExponent).To(Equal(uint8(13)))
|
Expect(p.AckDelayExponent).To(Equal(uint8(13)))
|
||||||
@@ -132,13 +132,13 @@ var _ = Describe("Transport Parameters", func() {
|
|||||||
Expect(p.Unmarshal(prependLength(b.Bytes()), protocol.PerspectiveServer)).To(MatchError("TRANSPORT_PARAMETER_ERROR: invalid value for max_packet_size: 1199 (minimum 1200)"))
|
Expect(p.Unmarshal(prependLength(b.Bytes()), protocol.PerspectiveServer)).To(MatchError("TRANSPORT_PARAMETER_ERROR: invalid value for max_packet_size: 1199 (minimum 1200)"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("errors when disable_migration has content", func() {
|
It("errors when disable_active_migration has content", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
utils.BigEndian.WriteUint16(b, uint16(disableMigrationParameterID))
|
utils.BigEndian.WriteUint16(b, uint16(disableActiveMigrationParameterID))
|
||||||
utils.BigEndian.WriteUint16(b, 6)
|
utils.BigEndian.WriteUint16(b, 6)
|
||||||
b.Write([]byte("foobar"))
|
b.Write([]byte("foobar"))
|
||||||
p := &TransportParameters{}
|
p := &TransportParameters{}
|
||||||
Expect(p.Unmarshal(prependLength(b.Bytes()), protocol.PerspectiveServer)).To(MatchError("TRANSPORT_PARAMETER_ERROR: wrong length for disable_migration: 6 (expected empty)"))
|
Expect(p.Unmarshal(prependLength(b.Bytes()), protocol.PerspectiveServer)).To(MatchError("TRANSPORT_PARAMETER_ERROR: wrong length for disable_active_migration: 6 (expected empty)"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("errors when the max_ack_delay is too large", func() {
|
It("errors when the max_ack_delay is too large", func() {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const (
|
|||||||
initialMaxStreamsUniParameterID transportParameterID = 0x9
|
initialMaxStreamsUniParameterID transportParameterID = 0x9
|
||||||
ackDelayExponentParameterID transportParameterID = 0xa
|
ackDelayExponentParameterID transportParameterID = 0xa
|
||||||
maxAckDelayParameterID transportParameterID = 0xb
|
maxAckDelayParameterID transportParameterID = 0xb
|
||||||
disableMigrationParameterID transportParameterID = 0xc
|
disableActiveMigrationParameterID transportParameterID = 0xc
|
||||||
preferredAddressParamaterID transportParameterID = 0xd
|
preferredAddressParamaterID transportParameterID = 0xd
|
||||||
activeConnectionIDLimitParameterID transportParameterID = 0xe
|
activeConnectionIDLimitParameterID transportParameterID = 0xe
|
||||||
)
|
)
|
||||||
@@ -63,7 +63,7 @@ type TransportParameters struct {
|
|||||||
MaxAckDelay time.Duration
|
MaxAckDelay time.Duration
|
||||||
AckDelayExponent uint8
|
AckDelayExponent uint8
|
||||||
|
|
||||||
DisableMigration bool
|
DisableActiveMigration bool
|
||||||
|
|
||||||
MaxPacketSize protocol.ByteCount
|
MaxPacketSize protocol.ByteCount
|
||||||
|
|
||||||
@@ -143,11 +143,11 @@ func (p *TransportParameters) unmarshal(data []byte, sentBy protocol.Perspective
|
|||||||
if err := p.readPreferredAddress(r, int(paramLen)); err != nil {
|
if err := p.readPreferredAddress(r, int(paramLen)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case disableMigrationParameterID:
|
case disableActiveMigrationParameterID:
|
||||||
if paramLen != 0 {
|
if paramLen != 0 {
|
||||||
return fmt.Errorf("wrong length for disable_migration: %d (expected empty)", paramLen)
|
return fmt.Errorf("wrong length for disable_active_migration: %d (expected empty)", paramLen)
|
||||||
}
|
}
|
||||||
p.DisableMigration = true
|
p.DisableActiveMigration = true
|
||||||
case statelessResetTokenParameterID:
|
case statelessResetTokenParameterID:
|
||||||
if sentBy == protocol.PerspectiveClient {
|
if sentBy == protocol.PerspectiveClient {
|
||||||
return errors.New("client sent a stateless_reset_token")
|
return errors.New("client sent a stateless_reset_token")
|
||||||
@@ -329,9 +329,9 @@ func (p *TransportParameters) Marshal() []byte {
|
|||||||
if p.AckDelayExponent != protocol.DefaultAckDelayExponent {
|
if p.AckDelayExponent != protocol.DefaultAckDelayExponent {
|
||||||
p.marshalVarintParam(b, ackDelayExponentParameterID, uint64(p.AckDelayExponent))
|
p.marshalVarintParam(b, ackDelayExponentParameterID, uint64(p.AckDelayExponent))
|
||||||
}
|
}
|
||||||
// disable_migration
|
// disable_active_migration
|
||||||
if p.DisableMigration {
|
if p.DisableActiveMigration {
|
||||||
utils.BigEndian.WriteUint16(b, uint16(disableMigrationParameterID))
|
utils.BigEndian.WriteUint16(b, uint16(disableActiveMigrationParameterID))
|
||||||
utils.BigEndian.WriteUint16(b, 0)
|
utils.BigEndian.WriteUint16(b, 0)
|
||||||
}
|
}
|
||||||
if p.StatelessResetToken != nil {
|
if p.StatelessResetToken != nil {
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ var newSession = func(
|
|||||||
MaxUniStreamNum: protocol.StreamNum(s.config.MaxIncomingUniStreams),
|
MaxUniStreamNum: protocol.StreamNum(s.config.MaxIncomingUniStreams),
|
||||||
MaxAckDelay: protocol.MaxAckDelayInclGranularity,
|
MaxAckDelay: protocol.MaxAckDelayInclGranularity,
|
||||||
AckDelayExponent: protocol.AckDelayExponent,
|
AckDelayExponent: protocol.AckDelayExponent,
|
||||||
DisableMigration: true,
|
DisableActiveMigration: true,
|
||||||
StatelessResetToken: &statelessResetToken,
|
StatelessResetToken: &statelessResetToken,
|
||||||
OriginalConnectionID: origDestConnID,
|
OriginalConnectionID: origDestConnID,
|
||||||
ActiveConnectionIDLimit: protocol.MaxActiveConnectionIDs,
|
ActiveConnectionIDLimit: protocol.MaxActiveConnectionIDs,
|
||||||
@@ -356,7 +356,7 @@ var newClientSession = func(
|
|||||||
MaxUniStreamNum: protocol.StreamNum(s.config.MaxIncomingUniStreams),
|
MaxUniStreamNum: protocol.StreamNum(s.config.MaxIncomingUniStreams),
|
||||||
MaxAckDelay: protocol.MaxAckDelayInclGranularity,
|
MaxAckDelay: protocol.MaxAckDelayInclGranularity,
|
||||||
AckDelayExponent: protocol.AckDelayExponent,
|
AckDelayExponent: protocol.AckDelayExponent,
|
||||||
DisableMigration: true,
|
DisableActiveMigration: true,
|
||||||
ActiveConnectionIDLimit: protocol.MaxActiveConnectionIDs,
|
ActiveConnectionIDLimit: protocol.MaxActiveConnectionIDs,
|
||||||
}
|
}
|
||||||
cs, clientHelloWritten := handshake.NewCryptoSetupClient(
|
cs, clientHelloWritten := handshake.NewCryptoSetupClient(
|
||||||
|
|||||||
Reference in New Issue
Block a user