mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
rename acksegment
This commit is contained in:
parent
32da784549
commit
3ad83da7cb
@ -208,7 +208,7 @@ func (kcp *KCP) Input(data []byte) int {
|
||||
kcp.HandleOption(seg.Opt)
|
||||
kcp.receivingWorker.ProcessSegment(seg)
|
||||
kcp.lastPayloadTime = kcp.current
|
||||
case *ACKSegment:
|
||||
case *AckSegment:
|
||||
kcp.HandleOption(seg.Opt)
|
||||
if kcp.rmt_wnd < seg.ReceivingWindow {
|
||||
kcp.rmt_wnd = seg.ReceivingWindow
|
||||
|
@ -182,7 +182,7 @@ func (this *AckList) Clear(una uint32) {
|
||||
}
|
||||
|
||||
func (this *AckList) Flush(current uint32) {
|
||||
seg := new(ACKSegment)
|
||||
seg := new(AckSegment)
|
||||
for i := 0; i < len(this.numbers); i++ {
|
||||
if this.nextFlush[i] <= current {
|
||||
seg.Count++
|
||||
@ -292,7 +292,7 @@ func (this *ReceivingWorker) Flush() {
|
||||
}
|
||||
|
||||
func (this *ReceivingWorker) Write(seg ISegment) {
|
||||
ackSeg := seg.(*ACKSegment)
|
||||
ackSeg := seg.(*AckSegment)
|
||||
ackSeg.Conv = this.kcp.conv
|
||||
ackSeg.ReceivingNext = this.nextNumber
|
||||
ackSeg.ReceivingWindow = this.nextNumber + this.windowSize
|
||||
|
@ -64,7 +64,7 @@ func (this *DataSegment) Release() {
|
||||
this.Data.Release()
|
||||
}
|
||||
|
||||
type ACKSegment struct {
|
||||
type AckSegment struct {
|
||||
Conv uint16
|
||||
Opt SegmentOption
|
||||
ReceivingWindow uint32
|
||||
@ -74,11 +74,11 @@ type ACKSegment struct {
|
||||
TimestampList []uint32
|
||||
}
|
||||
|
||||
func (this *ACKSegment) ByteSize() int {
|
||||
func (this *AckSegment) ByteSize() int {
|
||||
return 2 + 1 + 1 + 4 + 4 + 1 + int(this.Count)*4 + int(this.Count)*4
|
||||
}
|
||||
|
||||
func (this *ACKSegment) Bytes(b []byte) []byte {
|
||||
func (this *AckSegment) Bytes(b []byte) []byte {
|
||||
b = serial.Uint16ToBytes(this.Conv, b)
|
||||
b = append(b, byte(SegmentCommandACK), byte(this.Opt))
|
||||
b = serial.Uint32ToBytes(this.ReceivingWindow, b)
|
||||
@ -91,7 +91,7 @@ func (this *ACKSegment) Bytes(b []byte) []byte {
|
||||
return b
|
||||
}
|
||||
|
||||
func (this *ACKSegment) Release() {}
|
||||
func (this *AckSegment) Release() {}
|
||||
|
||||
type CmdOnlySegment struct {
|
||||
Conv uint16
|
||||
@ -157,7 +157,7 @@ func ReadSegment(buf []byte) (ISegment, []byte) {
|
||||
}
|
||||
|
||||
if cmd == SegmentCommandACK {
|
||||
seg := &ACKSegment{
|
||||
seg := &AckSegment{
|
||||
Conv: conv,
|
||||
Opt: opt,
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func TestDataSegment(t *testing.T) {
|
||||
func TestACKSegment(t *testing.T) {
|
||||
assert := assert.On(t)
|
||||
|
||||
seg := &ACKSegment{
|
||||
seg := &AckSegment{
|
||||
Conv: 1,
|
||||
ReceivingWindow: 2,
|
||||
ReceivingNext: 3,
|
||||
@ -59,7 +59,7 @@ func TestACKSegment(t *testing.T) {
|
||||
assert.Int(len(bytes)).Equals(nBytes)
|
||||
|
||||
iseg, _ := ReadSegment(bytes)
|
||||
seg2 := iseg.(*ACKSegment)
|
||||
seg2 := iseg.(*AckSegment)
|
||||
assert.Uint16(seg2.Conv).Equals(seg.Conv)
|
||||
assert.Uint32(seg2.ReceivingWindow).Equals(seg.ReceivingWindow)
|
||||
assert.Uint32(seg2.ReceivingNext).Equals(seg.ReceivingNext)
|
||||
|
Loading…
Reference in New Issue
Block a user