forked from quic-go/quic-go
move all error things to new qerr package, replacing errorcodes
This commit is contained in:
@@ -6,14 +6,14 @@ import (
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/errorcodes"
|
||||
"github.com/lucas-clemente/quic-go/protocol"
|
||||
"github.com/lucas-clemente/quic-go/qerr"
|
||||
"github.com/lucas-clemente/quic-go/utils"
|
||||
)
|
||||
|
||||
// A ConnectionCloseFrame in QUIC
|
||||
type ConnectionCloseFrame struct {
|
||||
ErrorCode errorcodes.ErrorCode
|
||||
ErrorCode qerr.ErrorCode
|
||||
ReasonPhrase string
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func ParseConnectionCloseFrame(r *bytes.Reader) (*ConnectionCloseFrame, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
frame.ErrorCode = errorcodes.ErrorCode(errorCode)
|
||||
frame.ErrorCode = qerr.ErrorCode(errorCode)
|
||||
|
||||
reasonPhraseLen, err := utils.ReadUint16(r)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@ package frames
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/errorcodes"
|
||||
"github.com/lucas-clemente/quic-go/protocol"
|
||||
"github.com/lucas-clemente/quic-go/qerr"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
@@ -15,7 +15,7 @@ var _ = Describe("ConnectionCloseFrame", func() {
|
||||
b := bytes.NewReader([]byte{0x40, 0x19, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x4e, 0x6f, 0x20, 0x72, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x20, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2e})
|
||||
frame, err := ParseConnectionCloseFrame(b)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.ErrorCode).To(Equal(errorcodes.ErrorCode(0x19)))
|
||||
Expect(frame.ErrorCode).To(Equal(qerr.ErrorCode(0x19)))
|
||||
Expect(frame.ReasonPhrase).To(Equal("No recent network activity."))
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
})
|
||||
@@ -24,7 +24,7 @@ var _ = Describe("ConnectionCloseFrame", func() {
|
||||
b := bytes.NewReader([]byte{0x02, 0xAD, 0xFB, 0xCA, 0xDE, 0x00, 0x00})
|
||||
frame, err := ParseConnectionCloseFrame(b)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.ErrorCode).To(Equal(errorcodes.ErrorCode(0xDECAFBAD)))
|
||||
Expect(frame.ErrorCode).To(Equal(qerr.ErrorCode(0xDECAFBAD)))
|
||||
Expect(frame.ReasonPhrase).To(BeEmpty())
|
||||
Expect(b.Len()).To(Equal(0))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user