1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-05 07:50:24 +08:00

fix(nat): keep alive

This commit is contained in:
源文雨
2024-07-17 00:05:11 +09:00
parent 0482f001ec
commit 7d25f46813

View File

@@ -19,7 +19,7 @@ func (l *Link) keepAlive(dur int64) {
logrus.Infoln("[nat] start to keep alive")
t := time.NewTicker(time.Second * time.Duration(dur))
for range t.C {
if l.status == LINK_STATUS_DOWN || l.me.loop == nil {
if l.me.loop == nil {
return
}
n, err := l.WriteAndPut(head.NewPacket(head.ProtoHello, l.me.srcport, l.peerip, l.me.dstport, nil), false)
@@ -99,6 +99,9 @@ func (l *Link) onQuery(packet []byte) {
if eps == "" {
eps = l.rawep // use registered ep only
}
if eps == "" {
continue
}
if ok {
notify[p] = [2]string{
lnk.endpoint.Network(),