chore: make lint happy

This commit is contained in:
源文雨
2025-04-03 15:58:07 +09:00
parent 47c6e8f5cf
commit 1f7a42fd29

View File

@@ -106,42 +106,37 @@ func (m *Me) wait(data []byte, addr p2p.EndPoint) (h head.PacketBytes) {
return
}
if !peer.IsToMe(p.Dst()) { // 提前处理转发
ok = true
if !peer.allowtrans {
logrus.Warnln("[recv] refused to trans packet to", p.Dst().String()+":"+strconv.Itoa(int(p.DstPort)))
ok = true
return
}
// 转发
lnk := m.router.NextHop(p.Dst().String())
if lnk == nil {
logrus.Warnln("[recv] transfer drop packet: nil nexthop")
ok = true
return
}
if head.DecTTL(data) { // need drop
logrus.Warnln("[recv] transfer drop packet: zero ttl")
ok = true
return
}
go lnk.write2peer(pbuf.ParseBytes(data...).Copy(), seq)
if config.ShowDebugLog {
logrus.Debugln("[listen] trans", len(data), "bytes packet to", p.Dst().String()+":"+strconv.Itoa(int(p.DstPort)))
}
ok = true
return
}
if !p.Proto.HasMore() {
ok := p.WriteDataSegment(data, buf)
if !ok {
ok = true
if !p.WriteDataSegment(data, buf) {
logrus.Errorln("[recv]", strconv.FormatUint(uint64(seq), 16), "unexpected !ok")
ok = true
return
}
if config.ShowDebugLog {
logrus.Debugln("[recv]", strconv.FormatUint(uint64(seq), 16), len(data), "bytes full data waited")
}
h = header
ok = true
return
}
})