Skip to content

Commit

Permalink
fix(nat): keep alive
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Jul 16, 2024
1 parent 0482f00 commit 7d25f46
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gold/link/nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 7d25f46

Please sign in to comment.