fix: kcp 协议内部日志细节
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package transport
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -61,7 +60,7 @@ func (c *kcpPacketConnBase) logKCPPacketDebugRecord(record KCPPacketDebugRecord)
|
||||
_ = c.logger.LogKCPPacketDebugRecord(record)
|
||||
}
|
||||
|
||||
func (c *kcpPacketConnBase) newKCPPacketDebugRecord(event string, remoteAddr net.Addr, packetBytes int, tsUnixNano int64, udpTxID *uint32, kcpConv *uint32) KCPPacketDebugRecord {
|
||||
func (c *kcpPacketConnBase) newKCPPacketDebugRecord(event string, remoteAddr net.Addr, packetBytes int, tsUnixNano int64, udpTxID *uint32, kcpConv *uint32, segments []KCPPacketDebugSegment) KCPPacketDebugRecord {
|
||||
record := KCPPacketDebugRecord{
|
||||
Event: event,
|
||||
NodeRole: c.nodeRole,
|
||||
@@ -71,6 +70,7 @@ func (c *kcpPacketConnBase) newKCPPacketDebugRecord(event string, remoteAddr net
|
||||
PacketBytes: packetBytes,
|
||||
UDPTXID: udpTxID,
|
||||
KCPConv: kcpConv,
|
||||
Segments: append([]KCPPacketDebugSegment(nil), segments...),
|
||||
TSUnixNano: tsUnixNano,
|
||||
}
|
||||
if localAddr := c.conn.LocalAddr(); localAddr != nil {
|
||||
@@ -81,11 +81,3 @@ func (c *kcpPacketConnBase) newKCPPacketDebugRecord(event string, remoteAddr net
|
||||
}
|
||||
return record
|
||||
}
|
||||
|
||||
func parseKCPConversationID(packet []byte) *uint32 {
|
||||
if len(packet) < 4 {
|
||||
return nil
|
||||
}
|
||||
conv := binary.LittleEndian.Uint32(packet[:4])
|
||||
return &conv
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user