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

add more logs

This commit is contained in:
fumiama
2021-12-30 16:11:30 +08:00
parent c3d05635f0
commit 66d5778df3
3 changed files with 23 additions and 8 deletions

View File

@@ -15,8 +15,12 @@ func (l *Link) keepAlive() {
go func() {
t := time.NewTicker(time.Second * time.Duration(l.keepalive))
for range t.C {
_, _ = l.Write(head.NewPacket(head.ProtoHello, 0, l.peerip, 0, nil), false)
logrus.Infoln("[link.nat] send keep alive packet")
n, err := l.Write(head.NewPacket(head.ProtoHello, 0, l.peerip, 0, nil), false)
if err == nil {
logrus.Infoln("[link] send", n, "bytes keep alive packet")
} else {
logrus.Errorln("[link] send keep alive packet error:", err)
}
}
}()
logrus.Infoln("[link.nat] start to keep alive")