1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-12 21:00:27 +08:00

fix(tcp): recv on new endpoint

This commit is contained in:
源文雨
2024-07-16 23:04:19 +09:00
parent 39d8d5b755
commit 9a63b3c886
3 changed files with 39 additions and 3 deletions

View File

@@ -106,8 +106,13 @@ func (m *Me) dispatch(packet *head.Packet, addr p2p.EndPoint, index int, finish
return
}
if p.endpoint == nil || !p.endpoint.Euqal(addr) {
logrus.Infoln("[listen] @", index, "set endpoint of peer", p.peerip, "to", addr.String())
p.endpoint = addr
if m.ep.Network() == "udp" {
logrus.Infoln("[listen] @", index, "set endpoint of peer", p.peerip, "to", addr.String())
p.endpoint = addr
} else if !addr.Euqal(p.endpoint) && p.endpoint == nil { // tcp/ws, ep not registered
logrus.Infoln("[listen] @", index, "set endpoint of peer", p.peerip, "to", addr.String())
p.endpoint = addr
}
}
switch {
case p.IsToMe(packet.Dst):