forked from quic-go/quic-go
only use the conn ID backwards compatibility mode with draft-29
This commit is contained in:
@@ -62,6 +62,12 @@ func (vn VersionNumber) toGQUICVersion() int {
|
||||
return int(10*(vn-gquicVersion0)/0x100) + int(vn%0x10)
|
||||
}
|
||||
|
||||
// UseRetireBugBackwardsCompatibilityMode says if it is necessary to use the backwards compatilibity mode.
|
||||
// This is only the case if it 1. is enabled and 2. draft-29 is used.
|
||||
func UseRetireBugBackwardsCompatibilityMode(enabled bool, v VersionNumber) bool {
|
||||
return enabled && v == VersionDraft29
|
||||
}
|
||||
|
||||
// IsSupportedVersion returns true if the server supports this version
|
||||
func IsSupportedVersion(supported []VersionNumber, v VersionNumber) bool {
|
||||
for _, t := range supported {
|
||||
|
||||
@@ -49,6 +49,13 @@ var _ = Describe("Version", func() {
|
||||
}
|
||||
})
|
||||
|
||||
It("says if backwards compatibility mode should be used", func() {
|
||||
Expect(UseRetireBugBackwardsCompatibilityMode(true, VersionDraft29)).To(BeTrue())
|
||||
Expect(UseRetireBugBackwardsCompatibilityMode(true, VersionDraft32)).To(BeFalse())
|
||||
Expect(UseRetireBugBackwardsCompatibilityMode(false, VersionDraft29)).To(BeFalse())
|
||||
Expect(UseRetireBugBackwardsCompatibilityMode(false, VersionDraft32)).To(BeFalse())
|
||||
})
|
||||
|
||||
Context("highest supported version", func() {
|
||||
It("finds the supported version", func() {
|
||||
supportedVersions := []VersionNumber{1, 2, 3}
|
||||
|
||||
Reference in New Issue
Block a user