mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
rename original_connection_id to original_destination_connection_id TP
This commit is contained in:
parent
fe85b52eed
commit
7e62a2fecc
7 changed files with 131 additions and 131 deletions
|
@ -26,56 +26,56 @@ var _ = Describe("Transport Parameters", func() {
|
|||
|
||||
It("has a string representation", func() {
|
||||
p := &TransportParameters{
|
||||
InitialMaxStreamDataBidiLocal: 1234,
|
||||
InitialMaxStreamDataBidiRemote: 2345,
|
||||
InitialMaxStreamDataUni: 3456,
|
||||
InitialMaxData: 4567,
|
||||
MaxBidiStreamNum: 1337,
|
||||
MaxUniStreamNum: 7331,
|
||||
MaxIdleTimeout: 42 * time.Second,
|
||||
OriginalConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
||||
AckDelayExponent: 14,
|
||||
MaxAckDelay: 37 * time.Millisecond,
|
||||
StatelessResetToken: &[16]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00},
|
||||
ActiveConnectionIDLimit: 123,
|
||||
InitialMaxStreamDataBidiLocal: 1234,
|
||||
InitialMaxStreamDataBidiRemote: 2345,
|
||||
InitialMaxStreamDataUni: 3456,
|
||||
InitialMaxData: 4567,
|
||||
MaxBidiStreamNum: 1337,
|
||||
MaxUniStreamNum: 7331,
|
||||
MaxIdleTimeout: 42 * time.Second,
|
||||
OriginalDestinationConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
||||
AckDelayExponent: 14,
|
||||
MaxAckDelay: 37 * time.Millisecond,
|
||||
StatelessResetToken: &[16]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00},
|
||||
ActiveConnectionIDLimit: 123,
|
||||
}
|
||||
Expect(p.String()).To(Equal("&wire.TransportParameters{OriginalConnectionID: 0xdeadbeef, InitialMaxStreamDataBidiLocal: 1234, InitialMaxStreamDataBidiRemote: 2345, InitialMaxStreamDataUni: 3456, InitialMaxData: 4567, MaxBidiStreamNum: 1337, MaxUniStreamNum: 7331, MaxIdleTimeout: 42s, AckDelayExponent: 14, MaxAckDelay: 37ms, ActiveConnectionIDLimit: 123, StatelessResetToken: 0x112233445566778899aabbccddeeff00}"))
|
||||
Expect(p.String()).To(Equal("&wire.TransportParameters{OriginalDestinationConnectionID: 0xdeadbeef, InitialMaxStreamDataBidiLocal: 1234, InitialMaxStreamDataBidiRemote: 2345, InitialMaxStreamDataUni: 3456, InitialMaxData: 4567, MaxBidiStreamNum: 1337, MaxUniStreamNum: 7331, MaxIdleTimeout: 42s, AckDelayExponent: 14, MaxAckDelay: 37ms, ActiveConnectionIDLimit: 123, StatelessResetToken: 0x112233445566778899aabbccddeeff00}"))
|
||||
})
|
||||
|
||||
It("has a string representation, if there's no stateless reset token", func() {
|
||||
p := &TransportParameters{
|
||||
InitialMaxStreamDataBidiLocal: 1234,
|
||||
InitialMaxStreamDataBidiRemote: 2345,
|
||||
InitialMaxStreamDataUni: 3456,
|
||||
InitialMaxData: 4567,
|
||||
MaxBidiStreamNum: 1337,
|
||||
MaxUniStreamNum: 7331,
|
||||
MaxIdleTimeout: 42 * time.Second,
|
||||
OriginalConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
||||
AckDelayExponent: 14,
|
||||
MaxAckDelay: 37 * time.Second,
|
||||
ActiveConnectionIDLimit: 89,
|
||||
InitialMaxStreamDataBidiLocal: 1234,
|
||||
InitialMaxStreamDataBidiRemote: 2345,
|
||||
InitialMaxStreamDataUni: 3456,
|
||||
InitialMaxData: 4567,
|
||||
MaxBidiStreamNum: 1337,
|
||||
MaxUniStreamNum: 7331,
|
||||
MaxIdleTimeout: 42 * time.Second,
|
||||
OriginalDestinationConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
||||
AckDelayExponent: 14,
|
||||
MaxAckDelay: 37 * time.Second,
|
||||
ActiveConnectionIDLimit: 89,
|
||||
}
|
||||
Expect(p.String()).To(Equal("&wire.TransportParameters{OriginalConnectionID: 0xdeadbeef, InitialMaxStreamDataBidiLocal: 1234, InitialMaxStreamDataBidiRemote: 2345, InitialMaxStreamDataUni: 3456, InitialMaxData: 4567, MaxBidiStreamNum: 1337, MaxUniStreamNum: 7331, MaxIdleTimeout: 42s, AckDelayExponent: 14, MaxAckDelay: 37s, ActiveConnectionIDLimit: 89}"))
|
||||
Expect(p.String()).To(Equal("&wire.TransportParameters{OriginalDestinationConnectionID: 0xdeadbeef, InitialMaxStreamDataBidiLocal: 1234, InitialMaxStreamDataBidiRemote: 2345, InitialMaxStreamDataUni: 3456, InitialMaxData: 4567, MaxBidiStreamNum: 1337, MaxUniStreamNum: 7331, MaxIdleTimeout: 42s, AckDelayExponent: 14, MaxAckDelay: 37s, ActiveConnectionIDLimit: 89}"))
|
||||
})
|
||||
|
||||
It("marshals and unmarshals", func() {
|
||||
var token [16]byte
|
||||
rand.Read(token[:])
|
||||
params := &TransportParameters{
|
||||
InitialMaxStreamDataBidiLocal: protocol.ByteCount(getRandomValue()),
|
||||
InitialMaxStreamDataBidiRemote: protocol.ByteCount(getRandomValue()),
|
||||
InitialMaxStreamDataUni: protocol.ByteCount(getRandomValue()),
|
||||
InitialMaxData: protocol.ByteCount(getRandomValue()),
|
||||
MaxIdleTimeout: 0xcafe * time.Second,
|
||||
MaxBidiStreamNum: protocol.StreamNum(getRandomValue()),
|
||||
MaxUniStreamNum: protocol.StreamNum(getRandomValue()),
|
||||
DisableActiveMigration: true,
|
||||
StatelessResetToken: &token,
|
||||
OriginalConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
||||
AckDelayExponent: 13,
|
||||
MaxAckDelay: 42 * time.Millisecond,
|
||||
ActiveConnectionIDLimit: getRandomValue(),
|
||||
InitialMaxStreamDataBidiLocal: protocol.ByteCount(getRandomValue()),
|
||||
InitialMaxStreamDataBidiRemote: protocol.ByteCount(getRandomValue()),
|
||||
InitialMaxStreamDataUni: protocol.ByteCount(getRandomValue()),
|
||||
InitialMaxData: protocol.ByteCount(getRandomValue()),
|
||||
MaxIdleTimeout: 0xcafe * time.Second,
|
||||
MaxBidiStreamNum: protocol.StreamNum(getRandomValue()),
|
||||
MaxUniStreamNum: protocol.StreamNum(getRandomValue()),
|
||||
DisableActiveMigration: true,
|
||||
StatelessResetToken: &token,
|
||||
OriginalDestinationConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
||||
AckDelayExponent: 13,
|
||||
MaxAckDelay: 42 * time.Millisecond,
|
||||
ActiveConnectionIDLimit: getRandomValue(),
|
||||
}
|
||||
data := params.Marshal()
|
||||
|
||||
|
@ -90,7 +90,7 @@ var _ = Describe("Transport Parameters", func() {
|
|||
Expect(p.MaxIdleTimeout).To(Equal(params.MaxIdleTimeout))
|
||||
Expect(p.DisableActiveMigration).To(Equal(params.DisableActiveMigration))
|
||||
Expect(p.StatelessResetToken).To(Equal(params.StatelessResetToken))
|
||||
Expect(p.OriginalConnectionID).To(Equal(protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef}))
|
||||
Expect(p.OriginalDestinationConnectionID).To(Equal(protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef}))
|
||||
Expect(p.AckDelayExponent).To(Equal(uint8(13)))
|
||||
Expect(p.MaxAckDelay).To(Equal(42 * time.Millisecond))
|
||||
Expect(p.ActiveConnectionIDLimit).To(Equal(params.ActiveConnectionIDLimit))
|
||||
|
@ -253,10 +253,10 @@ var _ = Describe("Transport Parameters", func() {
|
|||
|
||||
It("errors if the client sent a stateless_reset_token", func() {
|
||||
params := &TransportParameters{
|
||||
OriginalConnectionID: protocol.ConnectionID{0xca, 0xfe},
|
||||
OriginalDestinationConnectionID: protocol.ConnectionID{0xca, 0xfe},
|
||||
}
|
||||
data := params.Marshal()
|
||||
Expect((&TransportParameters{}).Unmarshal(data, protocol.PerspectiveClient)).To(MatchError("TRANSPORT_PARAMETER_ERROR: client sent an original_connection_id"))
|
||||
Expect((&TransportParameters{}).Unmarshal(data, protocol.PerspectiveClient)).To(MatchError("TRANSPORT_PARAMETER_ERROR: client sent an original_destination_connection_id"))
|
||||
})
|
||||
|
||||
Context("preferred address", func() {
|
||||
|
|
|
@ -25,21 +25,21 @@ func init() {
|
|||
type transportParameterID uint64
|
||||
|
||||
const (
|
||||
originalConnectionIDParameterID transportParameterID = 0x0
|
||||
maxIdleTimeoutParameterID transportParameterID = 0x1
|
||||
statelessResetTokenParameterID transportParameterID = 0x2
|
||||
maxUDPPayloadSizeParameterID transportParameterID = 0x3
|
||||
initialMaxDataParameterID transportParameterID = 0x4
|
||||
initialMaxStreamDataBidiLocalParameterID transportParameterID = 0x5
|
||||
initialMaxStreamDataBidiRemoteParameterID transportParameterID = 0x6
|
||||
initialMaxStreamDataUniParameterID transportParameterID = 0x7
|
||||
initialMaxStreamsBidiParameterID transportParameterID = 0x8
|
||||
initialMaxStreamsUniParameterID transportParameterID = 0x9
|
||||
ackDelayExponentParameterID transportParameterID = 0xa
|
||||
maxAckDelayParameterID transportParameterID = 0xb
|
||||
disableActiveMigrationParameterID transportParameterID = 0xc
|
||||
preferredAddressParameterID transportParameterID = 0xd
|
||||
activeConnectionIDLimitParameterID transportParameterID = 0xe
|
||||
originalDestinationConnectionIDParameterID transportParameterID = 0x0
|
||||
maxIdleTimeoutParameterID transportParameterID = 0x1
|
||||
statelessResetTokenParameterID transportParameterID = 0x2
|
||||
maxUDPPayloadSizeParameterID transportParameterID = 0x3
|
||||
initialMaxDataParameterID transportParameterID = 0x4
|
||||
initialMaxStreamDataBidiLocalParameterID transportParameterID = 0x5
|
||||
initialMaxStreamDataBidiRemoteParameterID transportParameterID = 0x6
|
||||
initialMaxStreamDataUniParameterID transportParameterID = 0x7
|
||||
initialMaxStreamsBidiParameterID transportParameterID = 0x8
|
||||
initialMaxStreamsUniParameterID transportParameterID = 0x9
|
||||
ackDelayExponentParameterID transportParameterID = 0xa
|
||||
maxAckDelayParameterID transportParameterID = 0xb
|
||||
disableActiveMigrationParameterID transportParameterID = 0xc
|
||||
preferredAddressParameterID transportParameterID = 0xd
|
||||
activeConnectionIDLimitParameterID transportParameterID = 0xe
|
||||
)
|
||||
|
||||
// PreferredAddress is the value encoding in the preferred_address transport parameter
|
||||
|
@ -73,9 +73,9 @@ type TransportParameters struct {
|
|||
|
||||
PreferredAddress *PreferredAddress
|
||||
|
||||
StatelessResetToken *[16]byte
|
||||
OriginalConnectionID protocol.ConnectionID
|
||||
ActiveConnectionIDLimit uint64
|
||||
StatelessResetToken *[16]byte
|
||||
OriginalDestinationConnectionID protocol.ConnectionID
|
||||
ActiveConnectionIDLimit uint64
|
||||
}
|
||||
|
||||
// Unmarshal the transport parameters
|
||||
|
@ -155,11 +155,11 @@ func (p *TransportParameters) unmarshal(data []byte, sentBy protocol.Perspective
|
|||
var token [16]byte
|
||||
r.Read(token[:])
|
||||
p.StatelessResetToken = &token
|
||||
case originalConnectionIDParameterID:
|
||||
case originalDestinationConnectionIDParameterID:
|
||||
if sentBy == protocol.PerspectiveClient {
|
||||
return errors.New("client sent an original_connection_id")
|
||||
return errors.New("client sent an original_destination_connection_id")
|
||||
}
|
||||
p.OriginalConnectionID, _ = protocol.ReadConnectionID(r, int(paramLen))
|
||||
p.OriginalDestinationConnectionID, _ = protocol.ReadConnectionID(r, int(paramLen))
|
||||
default:
|
||||
r.Seek(int64(paramLen), io.SeekCurrent)
|
||||
}
|
||||
|
@ -347,10 +347,10 @@ func (p *TransportParameters) Marshal() []byte {
|
|||
b.Write(p.PreferredAddress.ConnectionID.Bytes())
|
||||
b.Write(p.PreferredAddress.StatelessResetToken[:])
|
||||
}
|
||||
if p.OriginalConnectionID.Len() > 0 {
|
||||
utils.WriteVarInt(b, uint64(originalConnectionIDParameterID))
|
||||
utils.WriteVarInt(b, uint64(p.OriginalConnectionID.Len()))
|
||||
b.Write(p.OriginalConnectionID.Bytes())
|
||||
if p.OriginalDestinationConnectionID.Len() > 0 {
|
||||
utils.WriteVarInt(b, uint64(originalDestinationConnectionIDParameterID))
|
||||
utils.WriteVarInt(b, uint64(p.OriginalDestinationConnectionID.Len()))
|
||||
b.Write(p.OriginalDestinationConnectionID.Bytes())
|
||||
}
|
||||
|
||||
// active_connection_id_limit
|
||||
|
@ -416,8 +416,8 @@ func (p *TransportParameters) ValidFor0RTT(tp *TransportParameters) bool {
|
|||
|
||||
// String returns a string representation, intended for logging.
|
||||
func (p *TransportParameters) String() string {
|
||||
logString := "&wire.TransportParameters{OriginalConnectionID: %s, InitialMaxStreamDataBidiLocal: %d, InitialMaxStreamDataBidiRemote: %d, InitialMaxStreamDataUni: %d, InitialMaxData: %d, MaxBidiStreamNum: %d, MaxUniStreamNum: %d, MaxIdleTimeout: %s, AckDelayExponent: %d, MaxAckDelay: %s, ActiveConnectionIDLimit: %d"
|
||||
logParams := []interface{}{p.OriginalConnectionID, p.InitialMaxStreamDataBidiLocal, p.InitialMaxStreamDataBidiRemote, p.InitialMaxStreamDataUni, p.InitialMaxData, p.MaxBidiStreamNum, p.MaxUniStreamNum, p.MaxIdleTimeout, p.AckDelayExponent, p.MaxAckDelay, p.ActiveConnectionIDLimit}
|
||||
logString := "&wire.TransportParameters{OriginalDestinationConnectionID: %s, InitialMaxStreamDataBidiLocal: %d, InitialMaxStreamDataBidiRemote: %d, InitialMaxStreamDataUni: %d, InitialMaxData: %d, MaxBidiStreamNum: %d, MaxUniStreamNum: %d, MaxIdleTimeout: %s, AckDelayExponent: %d, MaxAckDelay: %s, ActiveConnectionIDLimit: %d"
|
||||
logParams := []interface{}{p.OriginalDestinationConnectionID, p.InitialMaxStreamDataBidiLocal, p.InitialMaxStreamDataBidiRemote, p.InitialMaxStreamDataUni, p.InitialMaxData, p.MaxBidiStreamNum, p.MaxUniStreamNum, p.MaxIdleTimeout, p.AckDelayExponent, p.MaxAckDelay, p.ActiveConnectionIDLimit}
|
||||
if p.StatelessResetToken != nil { // the client never sends a stateless reset token
|
||||
logString += ", StatelessResetToken: %#x"
|
||||
logParams = append(logParams, *p.StatelessResetToken)
|
||||
|
|
|
@ -326,14 +326,14 @@ func (e eventKeyRetired) MarshalJSONObject(enc *gojay.Encoder) {
|
|||
type eventTransportParameters struct {
|
||||
Owner owner
|
||||
|
||||
OriginalConnectionID protocol.ConnectionID
|
||||
StatelessResetToken *[16]byte
|
||||
DisableActiveMigration bool
|
||||
MaxIdleTimeout time.Duration
|
||||
MaxUDPPayloadSize protocol.ByteCount
|
||||
AckDelayExponent uint8
|
||||
MaxAckDelay time.Duration
|
||||
ActiveConnectionIDLimit uint64
|
||||
OriginalDestinationConnectionID protocol.ConnectionID
|
||||
StatelessResetToken *[16]byte
|
||||
DisableActiveMigration bool
|
||||
MaxIdleTimeout time.Duration
|
||||
MaxUDPPayloadSize protocol.ByteCount
|
||||
AckDelayExponent uint8
|
||||
MaxAckDelay time.Duration
|
||||
ActiveConnectionIDLimit uint64
|
||||
|
||||
InitialMaxData protocol.ByteCount
|
||||
InitialMaxStreamDataBidiLocal protocol.ByteCount
|
||||
|
@ -351,8 +351,8 @@ func (e eventTransportParameters) IsNil() bool { return false }
|
|||
|
||||
func (e eventTransportParameters) MarshalJSONObject(enc *gojay.Encoder) {
|
||||
enc.StringKey("owner", e.Owner.String())
|
||||
if e.OriginalConnectionID != nil {
|
||||
enc.StringKey("original_connection_id", connectionID(e.OriginalConnectionID).String())
|
||||
if e.OriginalDestinationConnectionID != nil {
|
||||
enc.StringKey("original_destination_connection_id", connectionID(e.OriginalDestinationConnectionID).String())
|
||||
}
|
||||
if e.StatelessResetToken != nil {
|
||||
enc.StringKey("stateless_reset_token", fmt.Sprintf("%x", e.StatelessResetToken[:]))
|
||||
|
|
30
qlog/qlog.go
30
qlog/qlog.go
|
@ -172,21 +172,21 @@ func (t *tracer) ReceivedTransportParameters(tp *wire.TransportParameters) {
|
|||
func (t *tracer) recordTransportParameters(owner owner, tp *wire.TransportParameters) {
|
||||
t.mutex.Lock()
|
||||
t.recordEvent(time.Now(), &eventTransportParameters{
|
||||
Owner: owner,
|
||||
OriginalConnectionID: tp.OriginalConnectionID,
|
||||
StatelessResetToken: tp.StatelessResetToken,
|
||||
DisableActiveMigration: tp.DisableActiveMigration,
|
||||
MaxIdleTimeout: tp.MaxIdleTimeout,
|
||||
MaxUDPPayloadSize: tp.MaxUDPPayloadSize,
|
||||
AckDelayExponent: tp.AckDelayExponent,
|
||||
MaxAckDelay: tp.MaxAckDelay,
|
||||
ActiveConnectionIDLimit: tp.ActiveConnectionIDLimit,
|
||||
InitialMaxData: tp.InitialMaxData,
|
||||
InitialMaxStreamDataBidiLocal: tp.InitialMaxStreamDataBidiLocal,
|
||||
InitialMaxStreamDataBidiRemote: tp.InitialMaxStreamDataBidiRemote,
|
||||
InitialMaxStreamDataUni: tp.InitialMaxStreamDataUni,
|
||||
InitialMaxStreamsBidi: int64(tp.MaxBidiStreamNum),
|
||||
InitialMaxStreamsUni: int64(tp.MaxUniStreamNum),
|
||||
Owner: owner,
|
||||
OriginalDestinationConnectionID: tp.OriginalDestinationConnectionID,
|
||||
StatelessResetToken: tp.StatelessResetToken,
|
||||
DisableActiveMigration: tp.DisableActiveMigration,
|
||||
MaxIdleTimeout: tp.MaxIdleTimeout,
|
||||
MaxUDPPayloadSize: tp.MaxUDPPayloadSize,
|
||||
AckDelayExponent: tp.AckDelayExponent,
|
||||
MaxAckDelay: tp.MaxAckDelay,
|
||||
ActiveConnectionIDLimit: tp.ActiveConnectionIDLimit,
|
||||
InitialMaxData: tp.InitialMaxData,
|
||||
InitialMaxStreamDataBidiLocal: tp.InitialMaxStreamDataBidiLocal,
|
||||
InitialMaxStreamDataBidiRemote: tp.InitialMaxStreamDataBidiRemote,
|
||||
InitialMaxStreamDataUni: tp.InitialMaxStreamDataUni,
|
||||
InitialMaxStreamsBidi: int64(tp.MaxBidiStreamNum),
|
||||
InitialMaxStreamsUni: int64(tp.MaxUniStreamNum),
|
||||
})
|
||||
t.mutex.Unlock()
|
||||
}
|
||||
|
|
|
@ -171,20 +171,20 @@ var _ = Describe("Tracer", func() {
|
|||
|
||||
It("records sent transport parameters", func() {
|
||||
tracer.SentTransportParameters(&wire.TransportParameters{
|
||||
InitialMaxStreamDataBidiLocal: 1000,
|
||||
InitialMaxStreamDataBidiRemote: 2000,
|
||||
InitialMaxStreamDataUni: 3000,
|
||||
InitialMaxData: 4000,
|
||||
MaxBidiStreamNum: 10,
|
||||
MaxUniStreamNum: 20,
|
||||
MaxAckDelay: 123 * time.Millisecond,
|
||||
AckDelayExponent: 12,
|
||||
DisableActiveMigration: true,
|
||||
MaxUDPPayloadSize: 1234,
|
||||
MaxIdleTimeout: 321 * time.Millisecond,
|
||||
StatelessResetToken: &[16]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00},
|
||||
OriginalConnectionID: protocol.ConnectionID{0xde, 0xad, 0xc0, 0xde},
|
||||
ActiveConnectionIDLimit: 7,
|
||||
InitialMaxStreamDataBidiLocal: 1000,
|
||||
InitialMaxStreamDataBidiRemote: 2000,
|
||||
InitialMaxStreamDataUni: 3000,
|
||||
InitialMaxData: 4000,
|
||||
MaxBidiStreamNum: 10,
|
||||
MaxUniStreamNum: 20,
|
||||
MaxAckDelay: 123 * time.Millisecond,
|
||||
AckDelayExponent: 12,
|
||||
DisableActiveMigration: true,
|
||||
MaxUDPPayloadSize: 1234,
|
||||
MaxIdleTimeout: 321 * time.Millisecond,
|
||||
StatelessResetToken: &[16]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00},
|
||||
OriginalDestinationConnectionID: protocol.ConnectionID{0xde, 0xad, 0xc0, 0xde},
|
||||
ActiveConnectionIDLimit: 7,
|
||||
})
|
||||
entry := exportAndParseSingle()
|
||||
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
|
||||
|
@ -192,7 +192,7 @@ var _ = Describe("Tracer", func() {
|
|||
Expect(entry.Name).To(Equal("parameters_set"))
|
||||
ev := entry.Event
|
||||
Expect(ev).To(HaveKeyWithValue("owner", "local"))
|
||||
Expect(ev).To(HaveKeyWithValue("original_connection_id", "deadc0de"))
|
||||
Expect(ev).To(HaveKeyWithValue("original_destination_connection_id", "deadc0de"))
|
||||
Expect(ev).To(HaveKeyWithValue("stateless_reset_token", "112233445566778899aabbccddeeff00"))
|
||||
Expect(ev).To(HaveKeyWithValue("max_idle_timeout", float64(321)))
|
||||
Expect(ev).To(HaveKeyWithValue("max_udp_payload_size", float64(1234)))
|
||||
|
|
30
session.go
30
session.go
|
@ -261,19 +261,19 @@ var newSession = func(
|
|||
initialStream := newCryptoStream()
|
||||
handshakeStream := newCryptoStream()
|
||||
params := &wire.TransportParameters{
|
||||
InitialMaxStreamDataBidiLocal: protocol.InitialMaxStreamData,
|
||||
InitialMaxStreamDataBidiRemote: protocol.InitialMaxStreamData,
|
||||
InitialMaxStreamDataUni: protocol.InitialMaxStreamData,
|
||||
InitialMaxData: protocol.InitialMaxData,
|
||||
MaxIdleTimeout: s.config.MaxIdleTimeout,
|
||||
MaxBidiStreamNum: protocol.StreamNum(s.config.MaxIncomingStreams),
|
||||
MaxUniStreamNum: protocol.StreamNum(s.config.MaxIncomingUniStreams),
|
||||
MaxAckDelay: protocol.MaxAckDelayInclGranularity,
|
||||
AckDelayExponent: protocol.AckDelayExponent,
|
||||
DisableActiveMigration: true,
|
||||
StatelessResetToken: &statelessResetToken,
|
||||
OriginalConnectionID: origDestConnID,
|
||||
ActiveConnectionIDLimit: protocol.MaxActiveConnectionIDs,
|
||||
InitialMaxStreamDataBidiLocal: protocol.InitialMaxStreamData,
|
||||
InitialMaxStreamDataBidiRemote: protocol.InitialMaxStreamData,
|
||||
InitialMaxStreamDataUni: protocol.InitialMaxStreamData,
|
||||
InitialMaxData: protocol.InitialMaxData,
|
||||
MaxIdleTimeout: s.config.MaxIdleTimeout,
|
||||
MaxBidiStreamNum: protocol.StreamNum(s.config.MaxIncomingStreams),
|
||||
MaxUniStreamNum: protocol.StreamNum(s.config.MaxIncomingUniStreams),
|
||||
MaxAckDelay: protocol.MaxAckDelayInclGranularity,
|
||||
AckDelayExponent: protocol.AckDelayExponent,
|
||||
DisableActiveMigration: true,
|
||||
StatelessResetToken: &statelessResetToken,
|
||||
OriginalDestinationConnectionID: origDestConnID,
|
||||
ActiveConnectionIDLimit: protocol.MaxActiveConnectionIDs,
|
||||
}
|
||||
if s.qlogger != nil {
|
||||
s.qlogger.SentTransportParameters(params)
|
||||
|
@ -1275,8 +1275,8 @@ func (s *session) processTransportParameters(params *wire.TransportParameters) {
|
|||
}
|
||||
|
||||
// check the Retry token
|
||||
if s.perspective == protocol.PerspectiveClient && !params.OriginalConnectionID.Equal(s.origDestConnID) {
|
||||
s.closeLocal(qerr.NewError(qerr.TransportParameterError, fmt.Sprintf("expected original_connection_id to equal %s, is %s", s.origDestConnID, params.OriginalConnectionID)))
|
||||
if s.perspective == protocol.PerspectiveClient && !params.OriginalDestinationConnectionID.Equal(s.origDestConnID) {
|
||||
s.closeLocal(qerr.NewError(qerr.TransportParameterError, fmt.Sprintf("expected original_destination_connection_id to equal %s, is %s", s.origDestConnID, params.OriginalDestinationConnectionID)))
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -2259,27 +2259,27 @@ var _ = Describe("Client Session", func() {
|
|||
Expect(sess.idleTimeout).To(Equal(18 * time.Second))
|
||||
})
|
||||
|
||||
It("errors if the TransportParameters contain an original_connection_id, although no Retry was performed", func() {
|
||||
It("errors if the TransportParameters contain an original_destination_connection_id, although no Retry was performed", func() {
|
||||
params := &wire.TransportParameters{
|
||||
OriginalConnectionID: protocol.ConnectionID{0xde, 0xca, 0xfb, 0xad},
|
||||
StatelessResetToken: &[16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
|
||||
OriginalDestinationConnectionID: protocol.ConnectionID{0xde, 0xca, 0xfb, 0xad},
|
||||
StatelessResetToken: &[16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
|
||||
}
|
||||
expectClose()
|
||||
qlogger.EXPECT().ReceivedTransportParameters(params)
|
||||
sess.processTransportParameters(params)
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected original_connection_id to equal (empty), is 0xdecafbad")))
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected original_destination_connection_id to equal (empty), is 0xdecafbad")))
|
||||
})
|
||||
|
||||
It("errors if the TransportParameters contain a wrong original_connection_id", func() {
|
||||
It("errors if the TransportParameters contain a wrong original_destination_connection_id", func() {
|
||||
sess.origDestConnID = protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef}
|
||||
params := &wire.TransportParameters{
|
||||
OriginalConnectionID: protocol.ConnectionID{0xde, 0xca, 0xfb, 0xad},
|
||||
StatelessResetToken: &[16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
|
||||
OriginalDestinationConnectionID: protocol.ConnectionID{0xde, 0xca, 0xfb, 0xad},
|
||||
StatelessResetToken: &[16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
|
||||
}
|
||||
expectClose()
|
||||
qlogger.EXPECT().ReceivedTransportParameters(params)
|
||||
sess.processTransportParameters(params)
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected original_connection_id to equal 0xdeadbeef, is 0xdecafbad")))
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected original_destination_connection_id to equal 0xdeadbeef, is 0xdecafbad")))
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue