1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-30 07:40:25 +08:00
This commit is contained in:
fumiama
2021-10-24 20:29:44 +08:00
parent 8b6e74f756
commit fa1608165b
9 changed files with 158 additions and 100 deletions

View File

@@ -9,10 +9,10 @@ import (
)
func (l *Link) keepAlive() {
if l.peer.KeepAlive > 0 && !l.hasKeepRuning {
if l.KeepAlive > 0 && !l.hasKeepRuning {
l.hasKeepRuning = true
go func() {
t := time.NewTicker(time.Second * time.Duration(l.peer.KeepAlive))
t := time.NewTicker(time.Second * time.Duration(l.KeepAlive))
for range t.C {
_, _ = l.Write(head.NewPacket(head.ProtoHello, 0, 0, nil))
logrus.Infoln("[link.nat] send keep alive packet")