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
|
package quic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
@@ -81,7 +80,7 @@ func (s *cryptoStreamImpl) GetCryptoData() []byte {
|
|||||||
|
|
||||||
func (s *cryptoStreamImpl) Finish() error {
|
func (s *cryptoStreamImpl) Finish() error {
|
||||||
if s.queue.HasMoreData() {
|
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
|
s.finished = true
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ var _ = Describe("Crypto Stream", func() {
|
|||||||
Offset: 10,
|
Offset: 10,
|
||||||
})).To(Succeed())
|
})).To(Succeed())
|
||||||
err := str.Finish()
|
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() {
|
It("works with reordered data", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user