mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-12-13 05:14:17 +04:00
common/buf/multi_buffer.go: Fix Compact() (#5015)
Fixes https://github.com/XTLS/Xray-core/issues/5012 Co-authored-by: patterniha <71074308+patterniha@users.noreply.github.com>
This commit is contained in:
@@ -244,6 +244,14 @@ func (b *Buffer) Cap() int32 {
|
||||
return int32(len(b.v))
|
||||
}
|
||||
|
||||
// Available returns the available capacity of the buffer content.
|
||||
func (b *Buffer) Available() int32 {
|
||||
if b == nil {
|
||||
return 0
|
||||
}
|
||||
return int32(len(b.v)) - b.end
|
||||
}
|
||||
|
||||
// IsEmpty returns true if the buffer is empty.
|
||||
func (b *Buffer) IsEmpty() bool {
|
||||
return b.Len() == 0
|
||||
|
||||
Reference in New Issue
Block a user