append to a byte slice instead of a bytes.Buffer when serializing frames

This commit is contained in:
Marten Seemann
2022-08-28 23:05:07 +03:00
parent 65dd82ad90
commit 3ca1001951
50 changed files with 443 additions and 425 deletions

View File

@@ -26,10 +26,10 @@ func parsePathResponseFrame(r *bytes.Reader, _ protocol.VersionNumber) (*PathRes
return frame, nil
}
func (f *PathResponseFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error {
b.WriteByte(0x1b)
b.Write(f.Data[:])
return nil
func (f *PathResponseFrame) Write(b []byte, _ protocol.VersionNumber) ([]byte, error) {
b = append(b, 0x1b)
b = append(b, f.Data[:]...)
return b, nil
}
// Length of a written frame