mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 10:08:15 -05:00
allocate in advance
This commit is contained in:
parent
8b07c39281
commit
3ffef74d75
@ -90,8 +90,12 @@ type AckSegment struct {
|
|||||||
NumberList []uint32
|
NumberList []uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ackNumberLimit = 128
|
||||||
|
|
||||||
func NewAckSegment() *AckSegment {
|
func NewAckSegment() *AckSegment {
|
||||||
return new(AckSegment)
|
return &AckSegment{
|
||||||
|
NumberList: make([]uint32, 0, ackNumberLimit),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *AckSegment) Conversation() uint16 {
|
func (v *AckSegment) Conversation() uint16 {
|
||||||
@ -110,7 +114,7 @@ func (v *AckSegment) PutNumber(number uint32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *AckSegment) IsFull() bool {
|
func (v *AckSegment) IsFull() bool {
|
||||||
return v.Count == 128
|
return v.Count == ackNumberLimit
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *AckSegment) ByteSize() int {
|
func (v *AckSegment) ByteSize() int {
|
||||||
|
Loading…
Reference in New Issue
Block a user