mirror of https://github.com/pkg/sftp.git
encoding: it is no longer intended that Buffer/RawPacket would be pooled, the byte slices should be
This commit is contained in:
parent
ae26d72513
commit
caecc84def
|
@ -69,12 +69,6 @@ func (b *Buffer) Len() int {
|
||||||
return len(b.b) - b.off
|
return len(b.b) - b.off
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset resets the buffer to be empty, but it retains the underlying storage for use by future writes.
|
|
||||||
func (b *Buffer) Reset() {
|
|
||||||
b.b = b.b[:0]
|
|
||||||
b.off = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConsumeUint8 consumes a single byte from the Buffer.
|
// ConsumeUint8 consumes a single byte from the Buffer.
|
||||||
// If Buffer does not have enough data, it will return ErrShortPacket.
|
// If Buffer does not have enough data, it will return ErrShortPacket.
|
||||||
func (b *Buffer) ConsumeUint8() (uint8, error) {
|
func (b *Buffer) ConsumeUint8() (uint8, error) {
|
||||||
|
|
|
@ -61,12 +61,6 @@ type RawPacket struct {
|
||||||
Data Buffer
|
Data Buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset clears the pointers and reference-semantic variables of RawPacket,
|
|
||||||
// making it suitable to be put into a sync.Pool.
|
|
||||||
func (p *RawPacket) Reset() {
|
|
||||||
p.Data.Reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalPacket returns p as a two-part binary encoding of p.
|
// MarshalPacket returns p as a two-part binary encoding of p.
|
||||||
//
|
//
|
||||||
// The internal p.RequestID is overridden by the reqid argument.
|
// The internal p.RequestID is overridden by the reqid argument.
|
||||||
|
|
Loading…
Reference in New Issue