replace streamFrameQueue with just-in-time framing of written data

This commits replaces the stream frame queue with a framer which
requests data from the streams just when a frame is needed by the
packet packer. This simplifies a lot of things and allows some other
refactorings, see issue #83.

There are a few pending tests which will be fixed soon.
This commit is contained in:
Lucas Clemente
2016-07-07 18:04:10 +02:00
parent ee77e85af3
commit d1e3b541d3
15 changed files with 1019 additions and 1499 deletions

View File

@@ -82,7 +82,7 @@ var _ = Describe("StreamFrame", func() {
b := &bytes.Buffer{}
f := &StreamFrame{
StreamID: 1,
Data: []byte("f"),
Data: []byte{},
Offset: 0,
}
err := f.Write(b, 0)
@@ -94,7 +94,7 @@ var _ = Describe("StreamFrame", func() {
b := &bytes.Buffer{}
f := &StreamFrame{
StreamID: 0xDECAFBAD,
Data: []byte("f"),
Data: []byte{},
Offset: 0xDEADBEEFCAFE,
}
err := f.Write(b, 0)
@@ -115,9 +115,8 @@ var _ = Describe("StreamFrame", func() {
err := f.Write(b, 0)
Expect(err).ToNot(HaveOccurred())
minLength, _ := f.MinLength(0)
headerLength := minLength - 1
Expect(b.Bytes()[0] & 0x20).To(Equal(uint8(0x20)))
Expect(b.Bytes()[headerLength-2 : headerLength]).To(Equal([]byte{0x37, 0x13}))
Expect(b.Bytes()[minLength-2 : minLength]).To(Equal([]byte{0x37, 0x13}))
})
It("omits the data length field", func() {