forked from quic-go/quic-go
use the correct error code for crypto stream errors
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package quic
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -81,7 +80,7 @@ func (s *cryptoStreamImpl) GetCryptoData() []byte {
|
||||
|
||||
func (s *cryptoStreamImpl) Finish() error {
|
||||
if s.queue.HasMoreData() {
|
||||
return errors.New("encryption level changed, but crypto stream has more data to read")
|
||||
return qerr.NewError(qerr.ProtocolViolation, "encryption level changed, but crypto stream has more data to read")
|
||||
}
|
||||
s.finished = true
|
||||
return nil
|
||||
|
||||
@@ -97,7 +97,7 @@ var _ = Describe("Crypto Stream", func() {
|
||||
Offset: 10,
|
||||
})).To(Succeed())
|
||||
err := str.Finish()
|
||||
Expect(err).To(MatchError("encryption level changed, but crypto stream has more data to read"))
|
||||
Expect(err).To(MatchError("PROTOCOL_VIOLATION: encryption level changed, but crypto stream has more data to read"))
|
||||
})
|
||||
|
||||
It("works with reordered data", func() {
|
||||
|
||||
Reference in New Issue
Block a user