mirror of
https://github.com/fumiama/WireGold.git
synced 2025-09-26 19:21:11 +08:00
chore: make lint happy
This commit is contained in:
@@ -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
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user