forked from quic-go/quic-go
correctly handle errors when creating a new gQUIC key exchange
This commit is contained in:
@@ -3,7 +3,6 @@ package handshake
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/crypto"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
@@ -11,9 +10,11 @@ import (
|
||||
|
||||
var _ = Describe("Ephermal KEX", func() {
|
||||
It("has a consistent KEX", func() {
|
||||
kex1 := getEphermalKEX()
|
||||
kex1, err := getEphermalKEX()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(kex1).ToNot(BeNil())
|
||||
kex2 := getEphermalKEX()
|
||||
kex2, err := getEphermalKEX()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(kex2).ToNot(BeNil())
|
||||
Expect(kex1).To(Equal(kex2))
|
||||
})
|
||||
@@ -23,8 +24,12 @@ var _ = Describe("Ephermal KEX", func() {
|
||||
defer func() {
|
||||
kexLifetime = protocol.EphermalKeyLifetime
|
||||
}()
|
||||
kex := getEphermalKEX()
|
||||
kex, err := getEphermalKEX()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(kex).ToNot(BeNil())
|
||||
Eventually(func() crypto.KeyExchange { return getEphermalKEX() }).ShouldNot(Equal(kex))
|
||||
time.Sleep(kexLifetime)
|
||||
kex2, err := getEphermalKEX()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(kex2).ToNot(Equal(kex))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user