zhaojh329 / rttys

Access your device's terminal from anywhere via the web.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Abnormal update of ninactive when the device is offline

ziguayungui opened this issue · comments

Environment

rtty

  • arch:
  • os:
  • version:

rttys

  • arch:x86_64
  • os:Ubuntu
  • version: 18.04.6 LTS

Description

in device.go , 在设备离线情况下,ninactive 值更新存在问题。
now 和 dev.active 的差值会连续3次判断成立 -》 ninactive + 1

		case <-ticker.C:
			now := time.Now()
			if now.Sub(dev.active) > heartbeatInterval*3/2 {
				if dev.id == "" {
					return
				}

				log.Error().Msgf("Inactive device in long time: %s", dev.id)
				if ninactive > 1 {
					log.Error().Msgf("Inactive 3 times, now kill it: %s", dev.id)
					return
				}
				ninactive = ninactive + 1
			}