isConnectionDead checks if more than 15 seconds have passed since the client sent a keep alive packet
()
| 44 | |
| 45 | // isConnectionDead checks if more than 15 seconds have passed since the client sent a keep alive packet |
| 46 | func (p *Player) isConnectionDead() bool { |
| 47 | lastKeepAliveByClient := p.sbLastKeepalive.Load() |
| 48 | return lastKeepAliveByClient != 0 && time.Now().UnixMilli()-lastKeepAliveByClient > (15*1000) |
| 49 | } |
| 50 | |
| 51 | func (p *Player) listenPackets() { |
| 52 | keepAliveTicker := time.NewTicker(time.Second * 20) |