forked from quic-go/quic-go
fix error handling in the TLS crypto setup
There are two ways that an error can occur during the handshake: 1. as a return value from qtls.Handshake() 2. when new data is passed to the crypto setup via HandleData() We need to make sure that the RunHandshake() as well as HandleData() both return if an error occurs at any step during the handshake.
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package quic
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/wire"
|
||||
@@ -54,12 +52,4 @@ var _ = Describe("Crypto Stream Manager", func() {
|
||||
cs.EXPECT().HandleData([]byte("foobar"), protocol.EncryptionHandshake)
|
||||
Expect(csm.HandleCryptoFrame(f, protocol.EncryptionHandshake)).To(Succeed())
|
||||
})
|
||||
|
||||
It("returns the error if handling crypto data fails", func() {
|
||||
testErr := errors.New("test error")
|
||||
f := &wire.CryptoFrame{Data: []byte("foobar")}
|
||||
cs.EXPECT().HandleData([]byte("foobar"), protocol.EncryptionHandshake).Return(testErr)
|
||||
err := csm.HandleCryptoFrame(f, protocol.EncryptionHandshake)
|
||||
Expect(err).To(MatchError(testErr))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user