mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-29 23:30:37 +08:00
fix(nat): keep alive
This commit is contained in:
@@ -19,7 +19,7 @@ func (l *Link) keepAlive(dur int64) {
|
|||||||
logrus.Infoln("[nat] start to keep alive")
|
logrus.Infoln("[nat] start to keep alive")
|
||||||
t := time.NewTicker(time.Second * time.Duration(dur))
|
t := time.NewTicker(time.Second * time.Duration(dur))
|
||||||
for range t.C {
|
for range t.C {
|
||||||
if l.status == LINK_STATUS_DOWN || l.me.loop == nil {
|
if l.me.loop == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
n, err := l.WriteAndPut(head.NewPacket(head.ProtoHello, l.me.srcport, l.peerip, l.me.dstport, nil), false)
|
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 == "" {
|
if eps == "" {
|
||||||
eps = l.rawep // use registered ep only
|
eps = l.rawep // use registered ep only
|
||||||
}
|
}
|
||||||
|
if eps == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if ok {
|
if ok {
|
||||||
notify[p] = [2]string{
|
notify[p] = [2]string{
|
||||||
lnk.endpoint.Network(),
|
lnk.endpoint.Network(),
|
||||||
|
|||||||
Reference in New Issue
Block a user