mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-05 07:50:24 +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
|
return
|
||||||
}
|
}
|
||||||
if !peer.IsToMe(p.Dst()) { // 提前处理转发
|
if !peer.IsToMe(p.Dst()) { // 提前处理转发
|
||||||
|
ok = true
|
||||||
if !peer.allowtrans {
|
if !peer.allowtrans {
|
||||||
logrus.Warnln("[recv] refused to trans packet to", p.Dst().String()+":"+strconv.Itoa(int(p.DstPort)))
|
logrus.Warnln("[recv] refused to trans packet to", p.Dst().String()+":"+strconv.Itoa(int(p.DstPort)))
|
||||||
ok = true
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 转发
|
// 转发
|
||||||
lnk := m.router.NextHop(p.Dst().String())
|
lnk := m.router.NextHop(p.Dst().String())
|
||||||
if lnk == nil {
|
if lnk == nil {
|
||||||
logrus.Warnln("[recv] transfer drop packet: nil nexthop")
|
logrus.Warnln("[recv] transfer drop packet: nil nexthop")
|
||||||
ok = true
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if head.DecTTL(data) { // need drop
|
if head.DecTTL(data) { // need drop
|
||||||
logrus.Warnln("[recv] transfer drop packet: zero ttl")
|
logrus.Warnln("[recv] transfer drop packet: zero ttl")
|
||||||
ok = true
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
go lnk.write2peer(pbuf.ParseBytes(data...).Copy(), seq)
|
go lnk.write2peer(pbuf.ParseBytes(data...).Copy(), seq)
|
||||||
if config.ShowDebugLog {
|
if config.ShowDebugLog {
|
||||||
logrus.Debugln("[listen] trans", len(data), "bytes packet to", p.Dst().String()+":"+strconv.Itoa(int(p.DstPort)))
|
logrus.Debugln("[listen] trans", len(data), "bytes packet to", p.Dst().String()+":"+strconv.Itoa(int(p.DstPort)))
|
||||||
}
|
}
|
||||||
ok = true
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !p.Proto.HasMore() {
|
if !p.Proto.HasMore() {
|
||||||
ok := p.WriteDataSegment(data, buf)
|
|
||||||
if !ok {
|
|
||||||
logrus.Errorln("[recv]", strconv.FormatUint(uint64(seq), 16), "unexpected !ok")
|
|
||||||
ok = true
|
ok = true
|
||||||
|
if !p.WriteDataSegment(data, buf) {
|
||||||
|
logrus.Errorln("[recv]", strconv.FormatUint(uint64(seq), 16), "unexpected !ok")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if config.ShowDebugLog {
|
if config.ShowDebugLog {
|
||||||
logrus.Debugln("[recv]", strconv.FormatUint(uint64(seq), 16), len(data), "bytes full data waited")
|
logrus.Debugln("[recv]", strconv.FormatUint(uint64(seq), 16), len(data), "bytes full data waited")
|
||||||
}
|
}
|
||||||
h = header
|
h = header
|
||||||
ok = true
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user