clean up
This commit is contained in:
parent
768181df8a
commit
b4e3e3f4e7
@ -55,10 +55,6 @@ type Connection struct {
|
|||||||
// Connection timing
|
// Connection timing
|
||||||
lastPacketTime time.Time // Last received packet timestamp
|
lastPacketTime time.Time // Last received packet timestamp
|
||||||
lastAckTime time.Time // Last acknowledgment timestamp
|
lastAckTime time.Time // Last acknowledgment timestamp
|
||||||
|
|
||||||
// Flow control
|
|
||||||
sendWindow []bool // Sliding window for sent packets
|
|
||||||
windowStart uint16 // Start of the sliding window
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConnection creates a new connection instance with default settings
|
// NewConnection creates a new connection instance with default settings
|
||||||
@ -76,7 +72,6 @@ func NewConnection(addr *net.UDPAddr, conn *net.UDPConn, handler PacketHandler)
|
|||||||
fragmentMgr: NewFragmentManager(MaxPacketSize),
|
fragmentMgr: NewFragmentManager(MaxPacketSize),
|
||||||
combiner: NewPacketCombiner(),
|
combiner: NewPacketCombiner(),
|
||||||
outOfOrderMap: make(map[uint16]*ProtocolPacket),
|
outOfOrderMap: make(map[uint16]*ProtocolPacket),
|
||||||
sendWindow: make([]bool, DefaultWindowSize),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ func (p *ProtocolPacket) Serialize() []byte {
|
|||||||
var result []byte
|
var result []byte
|
||||||
|
|
||||||
// Handle variable opcode encoding
|
// Handle variable opcode encoding
|
||||||
if p.Opcode >= 0xFF {
|
if p.Opcode == 0xFF {
|
||||||
// 2-byte opcode format: [0x00][actual_opcode][data]
|
// 2-byte opcode format: [0x00][actual_opcode][data]
|
||||||
result = make([]byte, 2+len(p.Data))
|
result = make([]byte, 2+len(p.Data))
|
||||||
result[0] = 0x00
|
result[0] = 0x00
|
||||||
|
Loading…
x
Reference in New Issue
Block a user